\Stomp
A Stomp Connection
- Author: Hiram Chirino <hiram@hiramchirino.com>
Synopsis
class Stomp
{
- // members
- public boolean $sync = false;
- public integer $prefetchSize = 1;
- public $clientId = NULL;
- protected $_brokerUri = NULL;
- protected $_socket = NULL;
- protected array $_hosts = ;
- protected array $_params = ;
- protected array $_subscriptions = ;
- protected integer $_defaultPort = 61613;
- protected integer $_currentHost = 1;
- protected integer $_attempts = 10;
- protected string $_username = '';
- protected string $_password = '';
- protected $_sessionId;
- protected integer $_read_timeout_seconds = 60;
- protected integer $_read_timeout_milliseconds = 0;
- protected integer $_connect_timeout_seconds = 60;
- // methods
- public void __construct()
- protected void _init()
- protected boolean _processUrl()
- protected void _makeConnection()
- public boolean connect()
- public boolean isConnected()
- public string getSessionId()
- public boolean send()
- protected void _prepareReceipt()
- protected boolean _waitForReceipt()
- public boolean subscribe()
- public boolean unsubscribe()
- public boolean begin()
- public boolean commit()
- public void abort()
- public boolean ack()
- public void disconnect()
- protected void _writeFrame()
- public void setReadTimeout()
- public StompFrame readFrame()
- public boolean hasFrameToRead()
- protected void _reconnect()
- public void __destruct()
Members
protected
- $_attempts
- $_brokerUri
- $_connect_timeout_seconds
- $_currentHost
- $_defaultPort
- $_hosts
- $_params
- $_password
- $_read_timeout_milliseconds
- $_read_timeout_seconds
- $_sessionId
- $_socket
- $_subscriptions
- $_username
public
- $clientId
—
string
Client id used for durable subscriptions - $prefetchSize
—
int
Default prefetch size - $sync
—
boolean
Perform request synchronously
Methods
protected
- _init() — Initialize connection
- _makeConnection() — Make socket connection to the server
- _prepareReceipt() — Prepair frame receipt
- _processUrl() — Process broker URL
- _reconnect() — Reconnects and renews subscriptions (if there were any) Call this method when you detect connection problems
- _waitForReceipt() — Wait for receipt
- _writeFrame() — Write frame to server
public
- __construct() — Constructor
- __destruct() — Graceful object desruction
- abort() — Roll back a transaction in progress
- ack() — Acknowledge consumption of a message from a subscription Note: This operation is always asynchronous
- begin() — Start a transaction
- commit() — Commit a transaction in progress
- connect() — Connect to server
- disconnect() — Graceful disconnect from the server
- getSessionId() — Current stomp session ID
- hasFrameToRead() — Check if there is a frame to read
- isConnected() — Check if client session has ben established
- readFrame() — Read response frame from server
- send() — Send a message to a destination in the messaging system
- setReadTimeout() — Set timeout to wait for content to read
- subscribe() — Register to listen to a given destination
- unsubscribe() — Remove an existing subscription