Handles publication of messages, including the generation of the message envelope object.

Hierarchy

  • default

Constructors

Properties

aggregateType: string
broker: BrokerAsPromised
logger: Logger
messageType: string

Methods

  • Parameters

    • session: PublicationSession

    Returns void

  • Parameters

    • envelope: MessageEnvelope<unknown>
    • eventSigning: undefined | Required<Pick<ValueObject<{
          rmqChannelMax: (() => number);
          rmqDevMiddleware: (() => boolean);
          rmqEventSigningKeyVersion: (() => number);
          rmqEventSigningKeyVersionsToRevoke: (() => number[]);
          rmqEventSigningPrivateKey: (() => string);
          rmqEventSigningPublicKey: (() => string);
          rmqHost: (() => string);
          rmqMgmtHost: (() => undefined | string);
          rmqMgmtPort: (() => undefined | number);
          rmqMgmtProtocol: (() => undefined | string);
          rmqPassword: (() => string);
          rmqPort: (() => number);
          rmqProtocol: (() => string);
          rmqUser: (() => string);
          rmqVHost: (() => string);
          rmqVHostAssert: (() => boolean);
      }>, "rmqEventSigningPrivateKey" | "rmqEventSigningKeyVersion">>

    Returns {
        body: string | MessageEnvelope<unknown>;
        headers?: {
            x-mosaic-signature: string;
            x-mosaic-signature-key-version: number;
        };
    }

    • body: string | MessageEnvelope<unknown>
    • Optional headers?: {
          x-mosaic-signature: string;
          x-mosaic-signature-key-version: number;
      }
      • x-mosaic-signature: string
      • x-mosaic-signature-key-version: number
  • Parameters

    • error: Error
    • messageId: string

    Returns Promise<void>

  • Parameters

    • messageId: string

    Returns Promise<void>

  • Parameters

    • message: {
          fields?: {
              exchange?: string;
              replyCode?: number;
              replyText?: string;
              routingKey?: string;
          };
          properties?: {
              messageId?: string;
          };
      }
      • Optional fields?: {
            exchange?: string;
            replyCode?: number;
            replyText?: string;
            routingKey?: string;
        }
        • Optional exchange?: string
        • Optional replyCode?: number
        • Optional replyText?: string
        • Optional routingKey?: string
      • Optional properties?: {
            messageId?: string;
        }
        • Optional messageId?: string

    Returns Promise<void>

  • Parameters

    • messageId: string

    Returns Promise<void>

  • Publishes a message using a routing key and a set of headers to be passed as part of message options.

    Parameters

    • aggregateId: string

      The (database) ID of the aggregate type or use the const UNKNOWN_AGGREGATE_ID or MULTIPLE_AGGREGATE_IDS values.

    • payload: unknown

      message payload

    • envelopeOverrides: MessageEnvelopeOverrides = {}

      explicitly defined message envelope values, e.g. auth token or message context

    • options: PublicationConfig = {}

      explicitly defined message options, e.g. if additional header values should be passed

    • Optional eventSigning: Required<Pick<ValueObject<{
          rmqChannelMax: (() => number);
          rmqDevMiddleware: (() => boolean);
          rmqEventSigningKeyVersion: (() => number);
          rmqEventSigningKeyVersionsToRevoke: (() => number[]);
          rmqEventSigningPrivateKey: (() => string);
          rmqEventSigningPublicKey: (() => string);
          rmqHost: (() => string);
          rmqMgmtHost: (() => undefined | string);
          rmqMgmtPort: (() => undefined | number);
          rmqMgmtProtocol: (() => undefined | string);
          rmqPassword: (() => string);
          rmqPort: (() => number);
          rmqProtocol: (() => string);
          rmqUser: (() => string);
          rmqVHost: (() => string);
          rmqVHostAssert: (() => boolean);
      }>, "rmqEventSigningPrivateKey" | "rmqEventSigningKeyVersion">>

    Returns Promise<PublicationSession>

Generated using TypeDoc