Setu-TS
    Preparing search index...

    Function publishIntegrationEvent

    • Publishes one integration event: builds the envelope from the caller's already-typed payload and hands it to broker.publish on the definition's topic.

      The definition's parse function is deliberately NOT run here. parse is a narrowing function unknown → T, and a realistic one (a schema with defaults, coercion, or stripping) returns a different object than it was given — running it on publish would silently change what the producer asked to send. It also would not buy the guarantee it appears to: what the consumer parses is the value after a JSON round trip, which this call has not seen. The consequence is honest and documented: a producer CAN publish a payload its own consumers reject, and that surfaces at the consumer as a reason: 'parse' rejection.

      Type Parameters

      • T

        The event payload type

      Parameters

      Returns Promise<void>

      As a rejected promise when the options (or the value the definition's selector returns) fail §3.4 validation

      Whatever broker.publish rejects with, unchanged

      import { publishIntegrationEvent } from '@setu-ts/messaging-plugin';

      await publishIntegrationEvent(runtime, broker, orderPlaced, { orderId: '1' });

      0.6.0