Class DefaultReactorEventGateway
- All Implemented Interfaces:
DescribableComponent,ReactorEventGateway
ReactorEventGateway.
Builds a recursive interceptor chain that runs inside the Reactor subscription, then delegates to the Axon Framework
EventGateway.
Each event payload is converted to an EventMessage, run through the interceptor chain (which may enrich
metadata), and then passed to the delegate gateway. Since EventGateway.publish(List) preserves objects that
are already EventMessage instances, the enriched metadata is retained.
- Since:
- 4.4.2
- Author:
- Milan Savic, Theo Emanuelsson
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultReactorEventGateway(EventGateway eventGateway, MessageTypeResolver messageTypeResolver) Instantiate aDefaultReactorEventGatewaywithout dispatch interceptors.DefaultReactorEventGateway(EventGateway eventGateway, MessageTypeResolver messageTypeResolver, List<ReactorMessageDispatchInterceptor<? super EventMessage>> dispatchInterceptors) Instantiate aDefaultReactorEventGateway. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.reactor.core.publisher.Mono<Void> publish(@Nullable ProcessingContext context, List<?> events) Publishes the given list ofeventswithin the givencontext(if available) and returns aMonothat completes when publishing is done.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.extension.reactor.messaging.eventhandling.gateway.ReactorEventGateway
publish, publish, publish
-
Constructor Details
-
DefaultReactorEventGateway
public DefaultReactorEventGateway(EventGateway eventGateway, MessageTypeResolver messageTypeResolver, List<ReactorMessageDispatchInterceptor<? super EventMessage>> dispatchInterceptors) Instantiate aDefaultReactorEventGateway.- Parameters:
eventGateway- theEventGatewayto delegate event publishing tomessageTypeResolver- theMessageTypeResolverfor resolving message typesdispatchInterceptors- the list ofReactorMessageDispatchInterceptors to apply to events
-
DefaultReactorEventGateway
public DefaultReactorEventGateway(EventGateway eventGateway, MessageTypeResolver messageTypeResolver) Instantiate aDefaultReactorEventGatewaywithout dispatch interceptors.- Parameters:
eventGateway- theEventGatewayto delegate event publishing tomessageTypeResolver- theMessageTypeResolverfor resolving message types
-
-
Method Details
-
publish
public reactor.core.publisher.Mono<Void> publish(@Nullable ProcessingContext context, List<?> events) Description copied from interface:ReactorEventGatewayPublishes the given list ofeventswithin the givencontext(if available) and returns aMonothat completes when publishing is done.- Specified by:
publishin interfaceReactorEventGateway- Parameters:
context- the processing context, if any, to publish the giveneventsinevents- the events to publish- Returns:
- a
Monocompleting when the events have been published
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.Best Practices: As a general rule, all relevant fields of a
DescribableComponentimplementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing thedescribeTomethod, who should focus on providing information that is useful for understanding the component's configuration and state.Example implementation:
public void describeTo(ComponentDescriptor descriptor) { descriptor.describeProperty("name", this.name); descriptor.describeProperty("enabled", this.enabled); descriptor.describeProperty("configuration", this.configuration); // A nested component descriptor.describeProperty("handlers", this.eventHandlers); // A collection }- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-