Hi Saggi

Sounds like you need to handle all the socket i/o directly, rather than having 
Proton do it "under the covers", right?

To do this, you'll need to avoid using the Driver and Connector and Listener 
classes from the Python binding - these classes perform all socket management 
and I/O, for those apps which want to let proton handle it.

What you'll need to do is use the proton Transport class to pass network data 
into and out of the Proton protocol Engine.  There are no callbacks - you'll 
have to call into Proton, sending it bytes you've pulled from the network, and 
asking Proton if it has any data to send.  You then have to perform the socket 
I/O yourself.

I've written some python code that does exactly that - you might find it a 
useful example. See:

https://github.com/kgiusti/fusion

And, specifically on how to do socket I/O, take a look here:

https://github.com/kgiusti/fusion/blob/master/python/sockets.py

The "connection" in the read/write_socket* methods in sockets.py is an instance 
of the Connection object from here:

https://github.com/kgiusti/fusion/blob/master/python/connection.py

Which contains an instance of the Proton::Transport. You can see how I use the 
Transport API to feed/read bytes to/from Proton.

Let me know if that helps,


Also, here's a couple of docs describing Proton's architecture and the engine 
model, if you're interested.

https://cwiki.apache.org/confluence/display/qpid/Protocol+Engines
https://cwiki.apache.org/confluence/display/qpid/Proton+Architecture

----- Original Message -----
> From: "Saggi Mizrahi" <smizr...@redhat.com>
> To: proton@qpid.apache.org
> Cc: "Piotr Kliczewski" <pklic...@redhat.com>, "Barak Azulay" 
> <bazu...@redhat.com>
> Sent: Wednesday, January 22, 2014 7:03:37 AM
> Subject: Protocol detection
> 
> Hi, I'm from the VDSM project which is part of oVirt.
> We are in the process of adding multiple protocol support
> one of which is AMQP 1.0 though the proton library.
> 
> We want to keep only requiring one port so our solution is
> to "peek" at the stream, detect the protocol and then pass
> it to the proper protocol implementation.
> 
> So, in order to support SSL we have to do the SSL
> negotiation ourselves and pass read\write callbacks
> since we keep the SSL state of the session.
> 
> We've been trying to get this to work with the proton-python
> bindings but there doesn't seem to be a way to pass our own
> read\write callbacks.
> 
> Is there something were missing, is it something that's even
> planned\wanted?
> 
> Thanks
> 

-- 
-K

Reply via email to