EventBus

A Vert.x event-bus is a light-weight distributed messaging system which allows different parts of your application, or different applications and services to communicate with each in a loosely coupled way.

An event-bus supports publish-subscribe messaging, point-to-point messaging and request-response messaging.

Message delivery is best-effort and messages can be lost if failure of all or part of the event bus occurs.

Please refer to the documentation for more information on the event bus.

package

Default

Methods

__construct

__construct() 

Add an interceptor that will be called whenever a message is received by Vert.x

addInboundInterceptor( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Add an interceptor that will be called whenever a message is sent from Vert.x

addOutboundInterceptor( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Create a message consumer against the specified address.

consumer( $arg0,  $arg1 = null) : \io\vertx\jphp\core\eventbus\MessageConsumer<T>

The returned consumer is not yet registered at the address, registration will be effective when @see \io\vertx\jphp\core\eventbus\MessageConsumer::handler is called. param $address [string] the address that it will register it at consumer($address) Create a consumer and register it against the specified address. param $address [string] the address that will register it at param $handler [callable] the handler that will process the received messages consumer($address, $handler)

Arguments

$arg0

string

$arg1

callable

Response

\io\vertx\jphp\core\eventbus\MessageConsumer

the event bus message consumer

Whether the metrics are enabled for this measured object

isMetricsEnabled() : boolean

Response

boolean

{@code true} if metrics are enabled

Like @see \io\vertx\jphp\core\eventbus\EventBus::consumer but the address won't be propagated across the cluster.

localConsumer( $arg0,  $arg1 = null) : \io\vertx\jphp\core\eventbus\MessageConsumer<T>

param $address [string] the address to register it at localConsumer($address)

Like @see \io\vertx\jphp\core\eventbus\EventBus::consumer but the address won't be propagated across the cluster.

param $address [string] the address that will register it at param $handler [callable] the handler that will process the received messages localConsumer($address, $handler)

Arguments

$arg0

string

$arg1

callable

Response

\io\vertx\jphp\core\eventbus\MessageConsumer

the event bus message consumer

Publish a message.<p> The message will be delivered to all handlers registered to the address.

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

param $address [string] the address to publish it to param $message [mixed] the message, may be {@code null} publish($address, $message)

Like @see \io\vertx\jphp\core\eventbus\EventBus::publish but specifying options that can be used to configure the delivery.

param $address [string] the address to publish it to param $message [mixed] the message, may be {@code null} param $options [DeliveryOptions | array] the delivery options publish($address, $message, $options)

Arguments

$arg0

string

$arg1

mixed

$arg2

array | DeliveryOptions

Response

$this

a reference to this, so the API can be used fluently

Create a message publisher against the specified address.

publisher( $arg0,  $arg1 = null) : \io\vertx\jphp\core\eventbus\MessageProducer<T>

The returned publisher will invoke the @see \io\vertx\jphp\core\eventbus\EventBus::publish method when the stream @see \io\vertx\jphp\core\streams\WriteStream::write method is called with the publisher address and the provided data. param $address [string] The address to publish it to publisher($address) Like @see \io\vertx\jphp\core\eventbus\EventBus::publisher but specifying delivery options that will be used for configuring the delivery of the message. param $address [string] the address to publish it to param $options [DeliveryOptions | array] the delivery options publisher($address, $options)

Arguments

$arg0

string

$arg1

array | DeliveryOptions

Response

\io\vertx\jphp\core\eventbus\MessageProducer

The publisher

Remove an interceptor that was added by @see \io\vertx\jphp\core\eventbus\EventBus::addInboundInterceptor

removeInboundInterceptor( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Remove an interceptor that was added by @see \io\vertx\jphp\core\eventbus\EventBus::addOutboundInterceptor

removeOutboundInterceptor( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Sends a message.

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

The message will be delivered to at most one of the handlers registered to the address. param $address [string] the address to send it to param $message [mixed] the message, may be {@code null} send($address, $message) Like @see \io\vertx\jphp\core\eventbus\EventBus::send but specifying a replyHandler that will be called if the recipient subsequently replies to the message. param $address [string] the address to send it to param $message [mixed] the message, may be {@code null} param $replyHandler [callable] reply handler will be called when any reply from the recipient is received, may be {@code null} send($address, $message, $replyHandler) Like @see \io\vertx\jphp\core\eventbus\EventBus::send but specifying options that can be used to configure the delivery. param $address [string] the address to send it to param $message [mixed] the message, may be {@code null} param $options [DeliveryOptions | array] delivery options send($address, $message, $options) Like @see \io\vertx\jphp\core\eventbus\EventBus::send but specifying a replyHandler that will be called if the recipient subsequently replies to the message. param $address [string] the address to send it to param $message [mixed] the message, may be {@code null} param $options [DeliveryOptions | array] delivery options param $replyHandler [callable] reply handler will be called when any reply from the recipient is received, may be {@code null} send($address, $message, $options, $replyHandler)

Arguments

$arg0

string

$arg1

mixed

$arg2

callable | array | DeliveryOptions

$arg3

callable

Response

$this

a reference to this, so the API can be used fluently

Create a message sender against the specified address.

sender( $arg0,  $arg1 = null) : \io\vertx\jphp\core\eventbus\MessageProducer<T>

The returned sender will invoke the @see \io\vertx\jphp\core\eventbus\EventBus::send method when the stream @see \io\vertx\jphp\core\streams\WriteStream::write method is called with the sender address and the provided data. param $address [string] the address to send it to sender($address) Like @see \io\vertx\jphp\core\eventbus\EventBus::sender but specifying delivery options that will be used for configuring the delivery of the message. param $address [string] the address to send it to param $options [DeliveryOptions | array] the delivery options sender($address, $options)

Arguments

$arg0

string

$arg1

array | DeliveryOptions

Response

\io\vertx\jphp\core\eventbus\MessageProducer

The sender