Differences between revisions 2 and 13 (spanning 11 versions)
Revision 2 as of 2008-10-16 20:51:16
Size: 150
Editor: CarlNobile
Comment:
Revision 13 as of 2008-10-20 20:28:28
Size: 1069
Editor: CarlNobile
Comment: This code will only work as a client transport.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= StompTransport = ## page was renamed from QueueTransport
## page was renamed from StompTransport
= Client Queue Transport =
Line 5: Line 7:
[[attachment: stompTransport.py]] [[attachment:clientqueuetransport.py]]

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()
}}}

 1. Pass the queue name and the data into the handler.
 1. The {{{servers}}} variable is a sequence of sequences which itself is a sequence and the instantiated handler object.
 1. 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.
 1. The {{{timeout}}} in the poll call determines the time a {{{select.poll()}}} object will look for activity on the socket connection.

Client Queue Transport

I wrote a quick client transport and STOMP implementation that can be used with ActiveMQ.

clientqueuetransport.py

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()
  1. Pass the queue name and the data into the handler.
  2. The servers variable is a sequence of sequences which itself is a sequence and the instantiated handler object.

  3. 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.

  4. The timeout in the poll call determines the time a select.poll() object will look for activity on the socket connection.

ClientQueueTransport (last edited 2008-10-20 20:28:28 by CarlNobile)