BusInstance

A configured instance of a bus used to publish messages.

Properties

beforeSend

See Lifecycle hooks.

beforePublish

See Lifecycle hooks.

onError

See Lifecycle hooks.

afterReceive

See Lifecycle hooks.

beforeDispatch

See Lifecycle hooks.

afterDispatch

See Lifecycle hooks.

state

Gets the current state of the bus to see if it's started or stopped.

Methods

publish(event, [messageAttributes])

Publishes an event to the bus, with an optional set of attributes to attach to the outgoing message.

Arguments

ArgumentDescriptionDefault

event

The message to publish to the underlying transport

None

messageAttributes

An optional set of attributes that will be sent with the outgoing event

None

send(command, [messageAttributes])

Sends a command to the bus, with an optional set of attributes to attach to the outgoing message.

Arguments

ArgumentDescriptionDefault

command

A message to send to the underlying transport

None

messageAttributes

An optional set of attributes that will be sent with the outgoing

None

fail()

Instructs the bus that the current message being handled cannot be processed even with retries and instead should immediately be routed to the dead letter queue.

start()

Instructs the bus to start reading messages from the underlying service queue and dispatching to message handlers.

stop()

Stops a bus that has been started by .start(). This will wait for all running workers to complete their current message handling contexts before returning.

dispose()

Stops and disposes all resources allocated to the bus, as well as removing all handler registrations. The bus instance cannot be used after this has been called.

Last updated