Sticky attributes

Sticky attributes are similar to regular attributes except they will be copied to any message immediately or subsequently sent as a result of the original message being processed.

These can be sent by specifying a value for stickyAttributes

await bus.send(
  new ChargeCreditCard(),
    stickyAttributes: {
      ip: '',
      attempt: 0,
      automatic: true

Sticky attributes can be accessed using the stickyAttribtues of the second parameter of a handler.

import { MessageAttributes } from '@node-ts/bus-messages'

await Bus.configure()
    async (_: ChargeCreditCard, { stickyAttributes }: MessageAttributes) => console.log(attributes)

Last updated