| | |
- Frame
class Frame |
| |
Build and manage a STOMP Frame.
This is useful for connecting to and communicating with
Apache ActiveMQ, an open source Java Message Service (JMS)
message broker.
For specifics on the protocol, see: http://stomp.codehaus.org/Protocol
This library is basically a Python implementation of Perl's Net::Stomp
See: http://search.cpan.org/dist/Net-Stomp/lib/Net/Stomp.pm
To enable the ActiveMQ Broker for Stomp add the following to the activemq.xml configuration:
<connector>
<serverTransport uri="stomp://localhost:61613"/>
</connector> |
| |
Methods defined here:
- __init__(self, sock=None)
- Initialize Frame object
Passing a socket object is optional
>>> frameobj = Frame(socket)
- as_string(self)
- Make raw string from frame
Suitable for passing over socket to STOMP server
>>> stomp.send(frameobj.as_string())
- build_frame(self, args, want_receipt=False)
- Build a frame based on arguments
>>> frame = frameobj.build_frame(({'command':'CONNECT','headers':{}})
Optional argument to get receipt of message when planning to send.
>>> frame = frameobj.build_frame(({'command':'SEND',
... 'headers':headers,
... 'body':body},want_receipt=True)
- connect(self, sock)
- Connect to the STOMP server, get session id
>>> frameobj.connect(sock)
- parse_command(self, str)
- Parse command, return
>>> frameobj.parse_command(str)
- parse_frame(self)
- Parse data from socket
>>> frameobj.parse_frame()
- parse_headers(self, str)
- Parse headers, return
>>> frameobj.parse_headers(str)
- send_frame(self, frame)
- Send frame to server, get receipt if needed
>>> frameobj.send_frame(frame)
| |