📘
@node-test/bus
  • @node-ts/bus
  • Getting started
    • Installation
    • Handling messages
    • Shutting down cleanly
  • Reference
    • Bus
    • BusConfiguration
    • BusInstance
  • Getting help
  • Guide
    • Messages
      • Events
      • Commands
      • System messages
    • Message attributes
      • Correlation id
      • Attributes
      • Sticky attributes
    • Workflows
      • Creating a workflow
      • Starting
      • Handling
      • State
      • Completing
      • Example
    • Transports
      • RabbitMQ
      • Amazon SQS
      • Redis
      • Custom transports
    • Persistence
      • Postgres
      • MongoDB
      • Creating a persistence
    • Serializers
      • Class serializer
    • Loggers
      • Custom loggers
    • Middleware
    • Lifecycle hooks
    • Retry Strategies
    • Dependency injection
    • Long running processes
Powered by GitBook
On this page
  • Properties
  • beforeSend
  • beforePublish
  • onError
  • afterReceive
  • beforeDispatch
  • afterDispatch
  • state
  • Methods
  • publish(event, [messageAttributes])
  • send(command, [messageAttributes])
  • fail()
  • start()
  • stop()
  • dispose()

Was this helpful?

  1. Reference

BusInstance

PreviousBusConfigurationNextGetting help

Last updated 3 years ago

Was this helpful?

A configured instance of a bus used to publish messages.

Properties

beforeSend

See .

beforePublish

See .

onError

See .

afterReceive

See .

beforeDispatch

See .

afterDispatch

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

Argument
Description
Default

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

Argument
Description
Default

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.

See .

Lifecycle hooks
Lifecycle hooks
Lifecycle hooks
Lifecycle hooks
Lifecycle hooks
Lifecycle hooks