Interface WhenAggregateEventPublisher


public interface WhenAggregateEventPublisher
Interface to an object that publishes events on behalf of an aggregate, recording what the Saga does in reaction.

Axon Framework 5 has no DomainEventMessage, so the aggregate type, aggregate identifier and sequence number travel on the processing context rather than on the message. A Saga reads them as AggregateType, SourceId and SequenceNumber handler parameters, which is where Axon Framework 4 read them from the message. A handler declaring one of those is only invoked for an event that has an aggregate, so an event published through FixtureConfiguration.givenAPublished(Object) does not reach it.

Since:
1.1
Author:
Allard Buijze
  • Method Details

    • publishes

      FixtureExecutionResult publishes(Object event)
      Register the given event to be published on behalf of an aggregate. Activity caused by this event on the command bus and event sink is monitored and can be checked in the FixtureExecutionResult.
      Parameters:
      event - The event published by the aggregate
      Returns:
      a reference to the test results for the validation phase
    • publishes

      FixtureExecutionResult publishes(Object event, Map<String,String> metadata)
      Register the given event to be published on behalf of an aggregate, with given additional metadata. Activity caused by this event on the command bus and event sink is monitored and can be checked in the FixtureExecutionResult.
      Parameters:
      event - The event published by the aggregate
      metadata - The metadata to attach to the event
      Returns:
      a reference to the test results for the validation phase