Frames and communication - stompy.frame

exception stompy.frame.BrokerErrorResponse

Received error from the broker.

class stompy.frame.Frame(sock=None)

Build and manage a STOMP Frame.

Parameters:
  • sock – An open socket to the STOMP server.
as_string()

Raw string representation of this frame Suitable for passing over a socket to the STOMP server.

Example

>>> stomp.send(frameobj.as_string())
build_frame(args, want_receipt=False)

Build a frame based on a dict of arguments.

Parameters:
  • args – A dict of arguments for the frame.
  • want_receipt – Optional argument to get a receipt from the sever that the frame was received.

Example

>>> frame = frameobj.build_frame({"command": 'CONNECT',
                                  "headers": {},
                                  want_receipt=True)
connect(sock, username=None, password=None, clientid=None)

Connect to the STOMP server and get the session id.

Parameters:
  • sock – Socket object from stompy.stomp.Stomp.
  • username – Username for connection.
  • password – Password for connection.
  • clientid – Client identification for persistent connections
get_message(nb=False)

Get next message frame.

Parameters:
  • nb – Non-blocking: If this is set and there is no messages currently waiting, this functions returns None instead of waiting for more data.
get_reply(nb=False)

Get command reply frame.

Parameters:
  • nb – Non-blocking: If this is set and there is no messages currently waiting, this functions returns None instead of waiting for more data.
parse_command(command_str)

Parse command received from the server.

Parameters:
  • command_str – String to parse command from
parse_frame(nb=False)

Parse data from socket

Parameters:
  • nb – Non-blocking: If this is set and there is no messages currently waiting, this functions returns None instead of waiting for more data.

Example

>>> frameobj.parse_frame()
parse_headers(headers_str)

Parse headers received from the servers and convert to a dict.i

Parameters:
  • headers_str – String to parse headers from
send_frame(frame)

Send frame to server, get receipt if needed.

Parameters:
  • frameFrame instance to pass across the socket
class stompy.frame.IntermediateMessageQueue

Internal message queue that holds messages received by the server.

This to make sure a message isn’t received instead of a command response after issuing a receipt request.

get(frame, nb=False)

Get a new frame from the message queue. If no frame is available it try to get the next frame from the socket.

Parameters:
  • frame – A Frame instance.
  • nb – Non-blocking.
put(frame)

Put a new frame onto the message queue. :param frame: A Frame instance.

exception stompy.frame.UnknownBrokerResponseError

An unexpected response was received from the broker.

Previous topic

Client - stompy.stomp

Next topic

Simple Client - stompy.simple

This Page