Interface EventAppender
- All Superinterfaces:
DescribableComponent
- All Known Implementing Classes:
ProcessingContextEventAppender
Component that appends events to an
EventSink in the context of a ProcessingContext. This makes the
EventAppender the preferred way to append events from within another message handling method.
The events will be appended in the context this appender was created for. You can construct one through the
forContext(ProcessingContext).
When using annotation-based @MessageHandler-methods and
you have declared an argument of type EventAppender, the appender will automatically be injected by the
EventAppenderParameterResolverFactory.
As this component is ProcessingContext-scoped, it is not retrievable from the Configuration.
- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Context.ResourceKey<ProcessingContextEventAppender> -
Method Summary
Modifier and TypeMethodDescriptiondefault voidAppend a collection of events to the event store in the currentProcessingContext.voidAppend a collection of events to the event store in the currentProcessingContext.static EventAppenderforContext(ProcessingContext context) Creates an appender for the givenProcessingContext.static EventAppenderforContext(ProcessingContext context, EventSink eventSink, MessageTypeResolver messageTypeResolver) Creates an appender for the givenProcessingContextandEventSink.Methods inherited from interface org.axonframework.common.infra.DescribableComponent
describeTo
-
Field Details
-
RESOURCE_KEY
-
-
Method Details
-
forContext
Creates an appender for the givenProcessingContext.You can use this appender only for the context it was created for. There is no harm in using this method more than once, as the same appender will be returned.
- Parameters:
context- TheProcessingContextto create the appender for.- Returns:
- The created appender.
-
forContext
static EventAppender forContext(@Nonnull ProcessingContext context, @Nonnull EventSink eventSink, @Nonnull MessageTypeResolver messageTypeResolver) Creates an appender for the givenProcessingContextandEventSink. You can use this appender only for the context it was created for. There is no harm in using this method more than once, as the same appender will be returned.- Parameters:
context- TheProcessingContextto create the appender for.eventSink- TheEventSinkto use for the appender.messageTypeResolver- TheMessageTypeResolverto use for the appender.- Returns:
- The created appender.
-
append
Append a collection of events to the event store in the currentProcessingContext. The events will be published when the context commits.- Parameters:
events- The collection of events to publish.
-
append
Append a collection of events to the event store in the currentProcessingContext. The events will be published when the context commits.- Parameters:
events- The collection of events to publish.
-