Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Tristan Seligmann
On Sat, Mar 2, 2013 at 10:34 PM, Laurens Van Houtven <_...@lvh.cc> wrote: > Could you help me write an AMP implementation in Javascript? It's easy, > right? ;-) It can't be harder than writing a PB implementation in JavaScript ;) -- mithrandi, i Ainil en-Balandor, a faer Ambar __

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Glyph
On Mar 2, 2013, at 12:34 PM, Laurens Van Houtven <_...@lvh.cc> wrote: > Hey Glyph, > > As usual, I agree with most of what you have to say, but... > > On Sat, Mar 2, 2013 at 8:58 PM, Glyph wrote: > Deploying a polyglot AMP system is a breeze, even if you have to implement > AMP from scratch f

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Benjamin BERTRAND
Le 2 mars 2013 à 19:12, Tom Prince a écrit : > Benjamin BERTRAND writes: > >> Le 2 mars 2013 à 15:33, Laurens Van Houtven <_...@lvh.cc> a écrit : >> >>> I'm guessing that this is another question that will be solved as >>> soon as I see the code (perhaps you should put all your code up >>> so

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Laurens Van Houtven
Hey Glyph, As usual, I agree with most of what you have to say, but... On Sat, Mar 2, 2013 at 8:58 PM, Glyph wrote: > Deploying a polyglot AMP system is a breeze, even if you have to implement > AMP from scratch for the other language in order to do it ;). > Could you help me write an AMP impl

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Glyph
On Mar 2, 2013, at 5:46 AM, Phil Mayers wrote: > You seemed curious why someone wouldn't use AMP. Personally I have two > common use-cases: > > 1. Communicating between two trusted Twisted processes, for which PB > is good enough. There are two reasons that someone might want to consider AM

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Tom Prince
Benjamin BERTRAND writes: > Le 2 mars 2013 à 15:33, Laurens Van Houtven <_...@lvh.cc> a écrit : > >> I'm guessing that this is another question that will be solved as >> soon as I see the code (perhaps you should put all your code up >> somewhere); but all I do know is that all Deferreds buy you

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Tristan Seligmann
On Sat, Mar 2, 2013 at 6:36 PM, Phil Mayers wrote: > On 03/02/2013 03:24 PM, Tristan Seligmann wrote: > >> I don't really understand how this is any easier with PB than with >> AMP, though. With AMP, you "just" need the same command definitions on >> both sides. With PB, you need the exact same Py

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Phil Mayers
On 03/02/2013 04:36 PM, Phil Mayers wrote: > My point is that, for the use-cases *I* have, those limitations have not > proven to be a problem, so the effort Sorry, should have been: ...so the effort of deploying a protocol which avoids those limitations is not warranted. _

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Phil Mayers
On 03/02/2013 03:24 PM, Tristan Seligmann wrote: > I don't really understand how this is any easier with PB than with > AMP, though. With AMP, you "just" need the same command definitions on > both sides. With PB, you need the exact same Python code versions for > every class you are sending over

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Tristan Seligmann
On Sat, Mar 2, 2013 at 3:46 PM, Phil Mayers wrote: > AMP would be somewhat more attractive (to me) if it were possible to run > with the IDL just on the "server" (i.e. callee); this would achieve the > goal of protocol-level sanity checking, without the cost of having to > distribute the IDL to th

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Benjamin BERTRAND
Le 2 mars 2013 à 15:33, Laurens Van Houtven <_...@lvh.cc> a écrit : > I'm guessing that this is another question that will be solved as soon as I > see the code (perhaps you should put all your code up somewhere); but all I > do know is that all Deferreds buy you is an abstraction for organizin

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Laurens Van Houtven
I'm guessing that this is another question that will be solved as soon as I see the code (perhaps you should put all your code up somewhere); but all I do know is that all Deferreds buy you is an abstraction for organizing callbacks; it's not a dispatch mechanism (and if you're using it as one now,

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Benjamin BERTRAND
Le 2 mars 2013 à 14:53, Laurens Van Houtven <_...@lvh.cc> a écrit : > Ah, but that too appears to be missing in the original code ;-) > > The stuff you're doing with deferreds there seems a bit strange. In your > example, why not just call sendMessage when you get the packet? If I had only one

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Laurens Van Houtven
Ah, but that too appears to be missing in the original code ;-) The stuff you're doing with deferreds there seems a bit strange. In your example, why not just call sendMessage when you get the packet? On Sat, Mar 2, 2013 at 2:28 PM, Benjamin BERTRAND wrote: > > Le 2 mars 2013 à 10:08, Laurens

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Phil Mayers
On 03/02/2013 12:19 PM, Glyph wrote: > I wrote a blog post some time ago explaining why you want static > declarations, even if your programming language is all nice and dynamic: Being able to "early drop" bad PDUs is a fine notion, but it's not a property that comes with zero cost. If you feel

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Benjamin BERTRAND
Le 2 mars 2013 à 10:08, Laurens Van Houtven <_...@lvh.cc> a écrit : > Yes, that looks okay, but that wasn't in your original sample ;-) > > Yep, sorry about that. I was more focused on the ServerFactory and Protocol. The pcap in a thread comes from the link I mentioned in my first post: http:

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Glyph
On Mar 2, 2013, at 3:25 AM, Phil Mayers wrote: > On 03/01/2013 10:27 PM, Glyph wrote: > >> What is AMP too much of? Memory? CPU? Bandwidth? API complexity? >> Code size? As compared to what? > > FWIW, every time (all three of them...) I've looked at AMP I got rapidly > bored and ended

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Laurens Van Houtven
Fair enough, I only use AMP as the external interface (e.g. Javascript talking to me from a browser). On Sat, Mar 2, 2013 at 12:25 PM, Phil Mayers wrote: > On 03/01/2013 10:27 PM, Glyph wrote: > > > What is AMP too much of? Memory? CPU? Bandwidth? API complexity? > > Code size? As compa

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Phil Mayers
On 03/01/2013 10:27 PM, Glyph wrote: > What is AMP too much of? Memory? CPU? Bandwidth? API complexity? > Code size? As compared to what? FWIW, every time (all three of them...) I've looked at AMP I got rapidly bored and ended up using PB. My use-cases have usually been Twisted->Twiste

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Laurens Van Houtven
Yes, that looks okay, but that wasn't in your original sample ;-) I'm on my phone at the moment which isn't great for code review, but it looks like you only fire one deferred per line? On Mar 2, 2013 9:50 AM, "Benjamin BERTRAND" wrote: > > Le 2 mars 2013 à 04:34, exar...@twistedmatrix.com a écr

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Benjamin BERTRAND
Le 2 mars 2013 à 04:34, exar...@twistedmatrix.com a écrit : > On 1 Mar, 09:52 pm, bee...@gmail.com wrote: >> Thanks for the answer! >> >> I was hoping to avoid having to put something like AMP in place, >> because it looked a bit overkill for my case. >> I think I actually found a way :-) > >

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Benjamin BERTRAND
Le 1 mars 2013 à 23:27, Glyph a écrit : > > On Mar 1, 2013, at 1:52 PM, Benjamin BERTRAND wrote: > >> I was hoping to avoid having to put something like AMP in place, because it >> looked a bit overkill for my case. >> I think I actually found a way :-) > > > In what way is it "overkill"?

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-01 Thread exarkun
On 1 Mar, 09:52 pm, bee...@gmail.com wrote: >Thanks for the answer! > >I was hoping to avoid having to put something like AMP in place, >because it looked a bit overkill for my case. >I think I actually found a way :-) Unfortunately, it looks like the code that you shared will only work accident

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-01 Thread Glyph
On Mar 1, 2013, at 1:52 PM, Benjamin BERTRAND wrote: > I was hoping to avoid having to put something like AMP in place, because it > looked a bit overkill for my case. > I think I actually found a way :-) In what way is it "overkill"? The dictionary says that

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-01 Thread Benjamin BERTRAND
Thanks for the answer! I was hoping to avoid having to put something like AMP in place, because it looked a bit overkill for my case. I think I actually found a way :-) I guess I can use the same factory to start all my servers. So I start my sniffer (in a thread) in my ServerFactory and I keep

Re: [Twisted-Python] How to dispatch message to different servers

2013-03-01 Thread Laurens Van Houtven
Well, you'd presumably have a connection to each of the servers in the form of a client factory and a protocol instance. Then, every time you get a message, you figure out which protocol instance you want (the one for the appropriate server) and send a message to it. You could do that with self.tra