1064
Comment:
|
1028
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= QueueTransport = | ## page was renamed from StompTransport = Client Queue Transport = |
Line 5: | Line 6: |
[[attachment:queueTransport.py]] | [[attachment:clientqueuetransport.py]] |
Line 22: | Line 23: |
I have begun the REST HTTP handler, and hopefully will get it finished before too long. |
Client Queue Transport
I wrote a quick client transport and STOMP implementation that can be used with ActiveMQ.
The transport can take multiple handlers all STOMP or a combination of STOMP, HTMP, XMPP, etc.
sh = StompHandler(queueName, data) servers = [(('localhost', 61613), sh),] ct = ClientTransport(servers) ct.connect(timeout=0.25) ct.poll(timeout=5) ct.close()
- Pass the queue name and the data into the handler.
The servers variable is a sequence of sequences which itself is a sequence and the instantiated handler object.
The timeout in the connect call determines the length of time the transport will try to make a connection to ActiveMQ. This is handy if you are doing this from a Web Service which needs to send a response to a client.
The timeout in the poll call determines the time a select.poll() object will look for activity on the socket connection.