Class TestEventPublisher
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 Summary
ConstructorsConstructorDescriptionTestEventPublisher(EventSink eventSink, MessageTypeResolver messageTypeResolver, EventConverter converter, Clock clock, IdGenerator idGenerator) Constructs a newTestEventPublisher -
Method Summary
Modifier and TypeMethodDescriptionPublishes the event.
-
Constructor Details
-
TestEventPublisher
public TestEventPublisher(EventSink eventSink, MessageTypeResolver messageTypeResolver, EventConverter converter, Clock clock, IdGenerator idGenerator) Constructs a newTestEventPublisher- Parameters:
eventSink- event sink to publish tomessageTypeResolver- message type resolverconverter- event converterclock- clock to use for event timestampsidGenerator- id generator to use for event ids
-
-
Method Details
-
publish
Publishes the event.- Parameters:
event- event message or payload to publish- Returns:
- a
CompletableFuturethat completes when the event has been published
-