Re: Twisted Application(Daemon) with multiple clients

Carl Waldbieser <[email protected]> Sun, 22 Oct 2017 20:28:27 -0400
Newsgroups gmane.comp.python.twisted.web
Message-ID <CAHPVzqY_0_+d+guRPLZpQrKmRFTF3LD5NAxa-z1U-kinqm5C=Q@mail.gmail.com>
--===============2386633503653017066==
Content-Type: multipart/alternative; boundary="001a11396f2eb62efc055c2be6bb"

--001a11396f2eb62efc055c2be6bb
Content-Type: text/plain; charset="UTF-8"

Without knowing many details, it seems like your approach seems
reasonable.  I'd have expected that your configuration service would act as
both a client (using the REST service to download configuration) and a
server (providing config information over UNIX sockets), but I don't really
know much about your particular set up.

To turn the program into a service, you could follow the steps for "Writing
A Twisted Plugin" [1], or "Using the Twisted Application Framework" [2].

Thanks,
Carl Waldbieser

[1]  http://twistedmatrix.com/documents/current/core/howto/tap.html
[2] http://twistedmatrix.com/documents/current/core/howto/application.html


On Tue, Oct 17, 2017 at 5:12 AM, Daniel Doron <[email protected]>
wrote:

> Hi,
>
> Sorry in advance for sending this to both Twisted mailing list. i was
> not sure for which was it was most appropriate.
>
> I have a design in which I would like to have a Twisted Application
> which would periodically connect to a REST Server to pull
> configuration information, i.e. as client and upon receiving that
> information and processing would communicate spawn 1 or more clients
> connecting to local process via Unix sockets to send them
> configuration information.
> I think I understand how the standard approach would be:
> 1. create a function that would be called with callLater/LoopingCall
> 2. in that function create my client, connect to the REST Server, get
> info etc...
>
> So:
> 1. Do you think my approach is correct? Essentially as explained I
> need a service/daemon to periodically connect ot one server to pull
> information and then connect to other local process to forward them
> the relevant configuration.
> 2. How do I turn this into a twisted plugin? (daemon)
>
>
> Thanks
> -Daniel
>
> _______________________________________________
> Twisted-web mailing list
> [email protected]
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>

--001a11396f2eb62efc055c2be6bb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Without knowing many details, it seems like your approach =
seems reasonable.=C2=A0 I&#39;d have expected that your configuration servi=
ce would act as both a client (using the REST service to download configura=
tion) and a server (providing config information over UNIX sockets), but I =
don&#39;t really know much about your particular set up.<div><br></div><div=
>To turn the program into a service, you could follow the steps for &quot;W=
riting A Twisted Plugin&quot; [1], or &quot;Using the Twisted Application F=
ramework&quot; [2].</div><div><br></div><div>Thanks,</div><div>Carl Waldbie=
ser</div><div><br></div><div>[1]=C2=A0=C2=A0<a href=3D"http://twistedmatrix=
.com/documents/current/core/howto/tap.html">http://twistedmatrix.com/docume=
nts/current/core/howto/tap.html</a></div><div>[2]=C2=A0<a href=3D"http://tw=
istedmatrix.com/documents/current/core/howto/application.html">http://twist=
edmatrix.com/documents/current/core/howto/application.html</a></div><div><b=
r></div></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On =
Tue, Oct 17, 2017 at 5:12 AM, Daniel Doron <span dir=3D"ltr">&lt;<a href=3D=
"mailto:[email protected]" target=3D"_blank">danielmeirdoron@gmail.=
com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Sorry in advance for sending this to both Twisted mailing list. i was<br>
not sure for which was it was most appropriate.<br>
<br>
I have a design in which I would like to have a Twisted Application<br>
which would periodically connect to a REST Server to pull<br>
configuration information, i.e. as client and upon receiving that<br>
information and processing would communicate spawn 1 or more clients<br>
connecting to local process via Unix sockets to send them<br>
configuration information.<br>
I think I understand how the standard approach would be:<br>
1. create a function that would be called with callLater/LoopingCall<br>
2. in that function create my client, connect to the REST Server, get<br>
info etc...<br>
<br>
So:<br>
1. Do you think my approach is correct? Essentially as explained I<br>
need a service/daemon to periodically connect ot one server to pull<br>
information and then connect to other local process to forward them<br>
the relevant configuration.<br>
2. How do I turn this into a twisted plugin? (daemon)<br>
<br>
<br>
Thanks<br>
-Daniel<br>
<br>
______________________________<wbr>_________________<br>
Twisted-web mailing list<br>
<a href=3D"mailto:[email protected]">Twisted-web@twistedmatrix.=
com</a><br>
<a href=3D"https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web" =
rel=3D"noreferrer" target=3D"_blank">https://twistedmatrix.com/cgi-<wbr>bin=
/mailman/listinfo/twisted-<wbr>web</a><br>
</blockquote></div><br></div>

--001a11396f2eb62efc055c2be6bb--

--===============2386633503653017066==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVHdpc3RlZC13
ZWIgbWFpbGluZyBsaXN0ClR3aXN0ZWQtd2ViQHR3aXN0ZWRtYXRyaXguY29tCmh0dHBzOi8vdHdp
c3RlZG1hdHJpeC5jb20vY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL3R3aXN0ZWQtd2ViCg==

--===============2386633503653017066==--