Class TestEventPublisher

java.lang.Object
io.axoniq.framework.workflow.runtime.test.utils.TestEventPublisher

@Internal public class TestEventPublisher extends Object
Test-oriented event publishing adapter for workflow tests.

This component is used by the workflow test infrastructure to publish events into the configured EventSink using the same messaging abstractions as the runtime. Tests can pass either a prebuilt EventMessage or a plain event payload. When a plain payload is provided, this publisher creates a GenericEventMessage, resolves its message type, assigns an id, stamps it with the configured clock, and applies the configured EventConverter before publication.

It is typically registered by test configuration helpers such as WorkflowTestEventPublicationEnhancer and used indirectly through higher-level APIs like WorkflowTestDriver and WorkflowTestFixture. This keeps fixture tests close to real runtime event publication while still allowing deterministic control over timestamps and generated identifiers.

Since:
5.4.0
Author:
Simon Zambrovski
  • Constructor Details

    • TestEventPublisher

      public TestEventPublisher(EventSink eventSink, MessageTypeResolver messageTypeResolver, EventConverter converter, Clock clock, IdGenerator idGenerator)
      Constructs a new TestEventPublisher
      Parameters:
      eventSink - event sink to publish to
      messageTypeResolver - message type resolver
      converter - event converter
      clock - clock to use for event timestamps
      idGenerator - id generator to use for event ids
  • Method Details

    • publish

      public CompletableFuture<Void> publish(Object event)
      Publishes the event.
      Parameters:
      event - event message or payload to publish
      Returns:
      a CompletableFuture that completes when the event has been published