class Stomp (View source)

Methods

__construct(string $broker = null, string $username = null, string $password = null, array $headers = [])

Connect to server

string|false
getSessionId()

Get the current stomp session ID

bool
disconnect()

Close stomp connection

bool
send(string $destination, string|StompFrame $msg, array $headers = [])

Sends a message to a destination in the messaging system

bool
subscribe(string $destination, array $headers = [])

Register to listen to a given destination

bool
unsubscribe(string $destination, array $headers = [])

Remove an existing subscription

bool
hasFrame()

Indicate whether or not there is a frame ready to read

object|false
readFrame(string $className = 'stompFrame')

Read the next frame

bool
begin(string $transaction_id)

Start a transaction

bool
commit(string $transaction_id)

Commit a transaction in progress

bool
abort(string $transaction_id)

Roll back a transaction in progress

bool
ack(string|StompFrame $msg, array $headers = [])

Acknowledge consumption of a message from a subscription using client acknowledgment

string|false
error()

Get the last stomp error

void
setTimeout(int $seconds, int $microseconds = 0)

Set timeout

array
getTimeout()

Get timeout

Details

__construct(string $broker = null, string $username = null, string $password = null, array $headers = [])

Connect to server

Parameters

string $broker

The broker URI

string $username

The username

string $password

The password

array $headers

additional headers (example: receipt).

string|false getSessionId()

Get the current stomp session ID

Return Value

string|false

stomp session ID if it exists, or FALSE otherwise

bool disconnect()

Close stomp connection

Return Value

bool

TRUE on success, or FALSE on failure

bool send(string $destination, string|StompFrame $msg, array $headers = [])

Sends a message to a destination in the messaging system

Parameters

string $destination

indicates where to send the message

string|StompFrame $msg

message to be sent

array $headers

additional headers (example: receipt).

Return Value

bool

TRUE on success, or FALSE on failure

bool subscribe(string $destination, array $headers = [])

Register to listen to a given destination

Parameters

string $destination

indicates which destination to subscribe to

array $headers

additional headers (example: receipt).

Return Value

bool

TRUE on success, or FALSE on failure

bool unsubscribe(string $destination, array $headers = [])

Remove an existing subscription

Parameters

string $destination

indicates which subscription to remove

array $headers

additional headers (example: receipt).

Return Value

bool

TRUE on success, or FALSE on failure

bool hasFrame()

Indicate whether or not there is a frame ready to read

Return Value

bool

TRUE if there is one, or FALSE otherwise

object|false readFrame(string $className = 'stompFrame')

Read the next frame

Parameters

string $className

name of the class to instantiate.

Return Value

object|false

on success, or FALSE on failure

bool begin(string $transaction_id)

Start a transaction

Parameters

string $transaction_id

transaction id

Return Value

bool

TRUE on success, or FALSE on failure

bool commit(string $transaction_id)

Commit a transaction in progress

Parameters

string $transaction_id

transaction id

Return Value

bool

TRUE on success, or FALSE on failure

bool abort(string $transaction_id)

Roll back a transaction in progress

Parameters

string $transaction_id

transaction id

Return Value

bool

TRUE on success, or FALSE on failure

bool ack(string|StompFrame $msg, array $headers = [])

Acknowledge consumption of a message from a subscription using client acknowledgment

Parameters

string|StompFrame $msg

message/messageId to be acknowledged

array $headers

additional headers (example: receipt).

Return Value

bool

TRUE on success, or FALSE on failure

string|false error()

Get the last stomp error

Return Value

string|false

Error message, or FALSE if no error

void setTimeout(int $seconds, int $microseconds = 0)

Set timeout

Parameters

int $seconds

the seconds part of the timeout to be set

int $microseconds

the microseconds part of the timeout to be set

Return Value

void

array getTimeout()

Get timeout

Return Value

array

Array with timeout informations