StompClientConnection

Once a connection to the STOMP server has been made, client receives a @see \io\vertx\jphp\ext\stomp\StompClientConnection, that let send and receive STOMP frames.

package

Default

Methods

__construct

__construct() 

Aborts a transaction.

abort( $arg0,  $arg1 = null,  $arg2 = null) : $this

param $id [string] the transaction id, must not be {@code null} abort($id)

Aborts a transaction.

param $id [string] the transaction id, must not be {@code null} param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the transaction cancellation has been processed by the server. The handler receives the sent frame ({@code ABORT}). abort($id, $receiptHandler)

Aborts a transaction.

param $id [string] the transaction id, must not be {@code null} param $headers [array] additional headers to send to the server. The {@code transaction} header is replaced by the value passed in the @{code id} parameter abort($id, $headers)

Aborts a transaction.

param $id [string] the transaction id, must not be {@code null} param $headers [array] additional headers to send to the server. The {@code transaction} header is replaced by the value passed in the @{code id} parameter param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the transaction cancellation has been processed by the server. The handler receives the sent frame ({@code ABORT}). abort($id, $headers, $receiptHandler)

Arguments

$arg0

string

$arg1

callable | array

$arg2

callable

Response

$this

the current {@link StompClientConnection}

Sends an acknowledgement for a specific message. It means that the message has been handled and processed by the client. The <code>id</code> parameter is the message id received in the frame.

ack( $arg0,  $arg1 = null,  $arg2 = null) : $this

param $id [string] the message id of the message to acknowledge ack($id)

Sends an acknowledgement for a specific message. It means that the message has been handled and processed by the client. The id parameter is the message id received in the frame.

param $id [string] the message id of the message to acknowledge param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the acknowledgment has been processed by the server. The handler receives the sent frame ({@code ACK}). ack($id, $receiptHandler)

Sends an acknowledgement for the given frame. It means that the frame has been handled and processed by the client. The sent acknowledgement is part of the transaction identified by the given id.

param $id [string] the message id of the message to acknowledge param $txId [string] the transaction id ack($id, $txId)

Sends an acknowledgement for the given frame. It means that the frame has been handled and processed by the client. The sent acknowledgement is part of the transaction identified by the given id.

param $id [string] the message id of the message to acknowledge param $txId [string] the transaction id param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the acknowledgment has been processed by the server. The handler receives the sent frame ({@code ACK}). ack($id, $txId, $receiptHandler)

Arguments

$arg0

string

$arg1

callable | string

$arg2

callable

Response

$this

the current {@link StompClientConnection}

Begins a transaction.

beginTX( $arg0,  $arg1 = null,  $arg2 = null) : $this

param $id [string] the transaction id, must not be {@code null} beginTX($id)

Begins a transaction.

param $id [string] the transaction id, must not be {@code null} param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the transaction begin has been processed by the server. The handler receives the sent frame ({@code BEGIN}). beginTX($id, $receiptHandler)

Begins a transaction.

param $id [string] the transaction id, must not be {@code null} param $headers [array] additional headers to send to the server. The {@code transaction} header is replaced by the value passed in the @{code id} parameter beginTX($id, $headers)

Begins a transaction.

param $id [string] the transaction id, must not be {@code null} param $headers [array] additional headers to send to the server. The {@code transaction} header is replaced by the value passed in the @{code id} parameter param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the transaction begin has been processed by the server. The handler receives the sent frame ({@code BEGIN}). beginTX($id, $headers, $receiptHandler)

Arguments

$arg0

string

$arg1

callable | array

$arg2

callable

Response

$this

the current {@link StompClientConnection}

Closes the connection without sending the <code>DISCONNECT</code> frame.

close() : void

Sets a handler notified when the STOMP connection is closed.

closeHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

the current {@link StompClientConnection}

Commits a transaction.

commit( $arg0,  $arg1 = null,  $arg2 = null) : $this

param $id [string] the transaction id, must not be {@code null} commit($id)

Commits a transaction.

param $id [string] the transaction id, must not be {@code null} param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the transaction commit has been processed by the server. The handler receives the sent frame ({@code COMMIT}). commit($id, $receiptHandler)

Commits a transaction.

param $id [string] the transaction id, must not be {@code null} param $headers [array] additional headers to send to the server. The {@code transaction} header is replaced by the value passed in the @{code id} parameter commit($id, $headers)

Commits a transaction.

param $id [string] the transaction id, must not be {@code null} param $headers [array] additional headers to send to the server. The {@code transaction} header is replaced by the value passed in the @{code id} parameter param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the transaction commit has been processed by the server. The handler receives the sent frame ({@code COMMIT}). commit($id, $headers, $receiptHandler)

Arguments

$arg0

string

$arg1

callable | array

$arg2

callable

Response

$this

the current {@link StompClientConnection}

Sets a handler notified when the server does not respond to a <code>ping</code> request in time. In other words, this handler is invoked when the heartbeat has detected a connection failure with the server.

connectionDroppedHandler( $arg0) : $this

The handler can decide to reconnect to the server.

Arguments

$arg0

callable

Response

$this

the current {@link StompClientConnection} receiving the dropped connection.

Disconnects the client. Unlike the @see \io\vertx\jphp\ext\stomp\StompClientConnection::close method, this method send the <code>DISCONNECT</code> frame to the server.

disconnect( $arg0 = null,  $arg1 = null) : $this

disconnect()

Disconnects the client. Unlike the @see \io\vertx\jphp\ext\stomp\StompClientConnection::close method, this method send the DISCONNECT frame to the server.

param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the disconnection has been processed by the server. The handler receives the sent frame ({@code DISCONNECT}). disconnect($receiptHandler)

Disconnects the client. Unlike the @see \io\vertx\jphp\ext\stomp\StompClientConnection::close method, this method send the DISCONNECT frame to the server. This method lets you customize the DISCONNECT frame.

param $frame [Frame | array] the {@code DISCONNECT} frame. disconnect($frame)

Disconnects the client. Unlike the @see \io\vertx\jphp\ext\stomp\StompClientConnection::close method, this method send the DISCONNECT frame to the server. This method lets you customize the DISCONNECT frame.

param $frame [Frame | array] the {@code DISCONNECT} frame. param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the disconnection has been processed by the server. The handler receives the sent frame ({@code DISCONNECT}). disconnect($frame, $receiptHandler)

Arguments

$arg0

Frame | callable | array

$arg1

callable

Response

$this

the current {@link StompClientConnection}

Sets a handler notified when an <code>ERROR</code> frame is received by the client. The handler receives the <code>ERROR</code> frame and a reference on the @see \io\vertx\jphp\ext\stomp\StompClientConnection.

errorHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

the current {@link StompClientConnection}

Configures the exception handler notified upon TCP-level errors.

exceptionHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

the current {@link StompClientConnection}

Returns whether or not the `CONNECTED` frame has been receive meaning that the Stomp connection is established.

isConnected() : boolean

Response

boolean

{@code true} if the connection is established, {@code false} otherwise

Sends a non-acknowledgement for the given message. It means that the message has not been handled by the client.

nack( $arg0,  $arg1 = null,  $arg2 = null) : $this

The id parameter is the message id received in the frame.

param $id [string] the message id of the message to acknowledge nack($id)

Sends a non-acknowledgement for the given message. It means that the message has not been handled by the client. The id parameter is the message id received in the frame.

param $id [string] the message id of the message to acknowledge param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the non-acknowledgment has been processed by the server. The handler receives the sent frame ({@code NACK}). nack($id, $receiptHandler)

Sends a non-acknowledgement for the given frame. It means that the frame has not been handled by the client. The sent non-acknowledgement is part of the transaction identified by the given id.

param $id [string] the message id of the message to acknowledge param $txId [string] the transaction id nack($id, $txId)

Sends a non-acknowledgement for the given frame. It means that the frame has not been handled by the client. The sent non-acknowledgement is part of the transaction identified by the given id.

param $id [string] the message id of the message to acknowledge param $txId [string] the transaction id param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the non-acknowledgment has been processed by the server. The handler receives the sent frame ({@code NACK}). nack($id, $txId, $receiptHandler)

Arguments

$arg0

string

$arg1

callable | string

$arg2

callable

Response

$this

the current {@link StompClientConnection}

Sets a handler that let customize the behavior when a ping needs to be sent to the server. Be aware that changing the default behavior may break the compliance with the STOMP specification.

pingHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

the current {@link StompClientConnection}

Configures a received handler that get notified when a STOMP frame is received by the client.

receivedFrameHandler( $arg0) : $this

This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified by the handler.

Unlike @see \io\vertx\jphp\ext\stomp\StompClient::receivedFrameHandler, the given handler won't receive the CONNECTED frame. If a received frame handler is set on the @see \io\vertx\jphp\ext\stomp\StompClient, it will be used by all clients connection, so calling this method is useless, except if you want to use a different handler.

Arguments

$arg0

callable

Response

$this

the current {@link StompClientConnection}

Sends the given frame to the server.

send( $arg0,  $arg1 = null,  $arg2 = null,  $arg3 = null) : $this

param $frame [Frame | array] the frame send($frame)

Sends a SEND frame to the server.

param $headers [array] the headers, must not be {@code null} param $body [Buffer] the body, may be {@code null} send($headers, $body)

Sends a SEND frame to the server to the given destination. The message does not have any other header.

param $destination [string] the destination, must not be {@code null} param $body [Buffer] the body, may be {@code null} send($destination, $body)

Sends the given frame to the server.

param $frame [Frame | array] the frame param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the sent frame has been received. The handler receives the sent frame. send($frame, $receiptHandler)

Sends a SEND frame to the server.

param $headers [array] the headers, must not be {@code null} param $body [Buffer] the body, may be {@code null} param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the sent frame has been received. The handler receives the sent frame. send($headers, $body, $receiptHandler)

Sends a SEND frame to the server to the given destination. The message does not have any other header.

param $destination [string] the destination, must not be {@code null} param $body [Buffer] the body, may be {@code null} param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the sent frame has been received. The handler receives the sent frame. send($destination, $body, $receiptHandler)

Sends a SEND frame to the server to the given destination.

param $destination [string] the destination, must not be {@code null} param $headers [array] the header. The {@code destination} header is replaced by the value given to the {@code destination} parameter param $body [Buffer] the body, may be {@code null} send($destination, $headers, $body)

Sends a SEND frame to the server to the given destination.

param $destination [string] the destination, must not be {@code null} param $headers [array] the header. The {@code destination} header is replaced by the value given to the {@code destination} parameter param $body [Buffer] the body, may be {@code null} param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the sent frame has been received. The handler receives the sent frame. send($destination, $headers, $body, $receiptHandler)

Arguments

$arg0

Frame | string | array

$arg1

Buffer | callable | array

$arg2

Buffer | callable

$arg3

callable

Response

$this

the current {@link StompClientConnection}

server

server() : string

Response

string

the server name.

session

session() : string

Response

string

the session id.

Subscribes to the given destination. This destination is used as subscription id.

subscribe( $arg0,  $arg1,  $arg2 = null,  $arg3 = null) : string

param $destination [string] the destination, must not be {@code null} param $handler [callable] the handler invoked when a message is received on the given destination. Must not be {@code null}. subscribe($destination, $handler)

Subscribes to the given destination. This destination is used as subscription id.

param $destination [string] the destination, must not be {@code null} param $handler [callable] the handler invoked when a message is received on the given destination. Must not be {@code null}. param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the subscription has been received. The handler receives the sent frame ({@code SUBSCRIBE}). subscribe($destination, $handler, $receiptHandler)

Subscribes to the given destination.

param $destination [string] the destination, must not be {@code null}. param $headers [array] the headers to configure the subscription. It may contain the {@code ack} header to configure the acknowledgment policy. If the given set of headers contains the {@code id} header, this value is used as subscription id. param $handler [callable] the handler invoked when a message is received on the given destination. Must not be {@code null}. subscribe($destination, $headers, $handler)

Subscribes to the given destination.

param $destination [string] the destination, must not be {@code null} param $headers [array] the headers to configure the subscription. It may contain the {@code ack} header to configure the acknowledgment policy. If the given set of headers contains the {@code id} header, this value is used as subscription id. param $handler [callable] the handler invoked when a message is received on the given destination. Must not be {@code null}. param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the subscription has been received. The handler receives the sent frame ({@code SUBSCRIBE}). subscribe($destination, $headers, $handler, $receiptHandler)

Arguments

$arg0

string

$arg1

callable | array

$arg2

callable

$arg3

callable

Response

string

the subscription id.

Un-subscribes from the given destination. This method only works if the subscription did not specifies a subscription id (using the <code>id</code> header).

unsubscribe( $arg0,  $arg1 = null,  $arg2 = null) : $this

param $destination [string] the destination unsubscribe($destination)

Un-subscribes from the given destination. This method only works if the subscription did not specifies a subscription id (using the id header).

param $destination [string] the destination param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the un-subscription has been received. The handler receives the sent frame ({@code UNSUBSCRIBE}). unsubscribe($destination, $receiptHandler)

Un-subscribes from the given destination. This method computes the subscription id as follows. If the given headers contains the id header, the header value is used. Otherwise the destination is used.

param $destination [string] the destination param $headers [array] the headers unsubscribe($destination, $headers)

Un-subscribes from the given destination. This method computes the subscription id as follows. If the given headers contains the id header, the header value is used. Otherwise the destination is used.

param $destination [string] the destination param $headers [array] the headers param $receiptHandler [callable] the handler invoked when the {@code RECEIPT} frame associated with the un-subscription has been received. The handler receives the sent frame ({@code UNSUBSCRIBE}). unsubscribe($destination, $headers, $receiptHandler)

Arguments

$arg0

string

$arg1

callable | array

$arg2

callable

Response

$this

the current {@link StompClientConnection}

version

version() : string

Response

string

the STOMP protocol version negotiated with the server.

Configures a handler notified when a frame is going to be written on the wire. This handler can be used from logging, debugging. The handler can modify the received frame.

writingFrameHandler( $arg0) : $this

If a writing frame handler is set on the @see \io\vertx\jphp\ext\stomp\StompClient, it will be used by all clients connection, so calling this method is useless, except if you want to use a different handler.

Arguments

$arg0

callable

Response

$this

the current {@link StompClientConnection}