Class PayloadConvertingQueryBusConnector
- All Implemented Interfaces:
DescribableComponent,QueryBusConnector
byte[] or another serialized form.- Since:
- 5.0.0
- Author:
- Jan Galinski
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.axonframework.messaging.queryhandling.distributed.QueryBusConnector
QueryBusConnector.Handler, QueryBusConnector.UpdateCallback -
Field Summary
Fields inherited from class org.axonframework.messaging.queryhandling.distributed.DelegatingQueryBusConnector
delegate -
Constructor Summary
ConstructorsConstructorDescriptionPayloadConvertingQueryBusConnector(QueryBusConnector delegate, MessageConverter converter, Class<?> targetType) Initialize thePayloadConvertingConnectorto use givenconverterto convert each Message's payload intotargetTypebefore passing it to givendelegate. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.voidonIncomingQuery(QueryBusConnector.Handler handler) Registers a handler to process incoming query messages.query(QueryMessage query, ProcessingContext context) Sends the givenqueryto the remote QueryBus.subscriptionQuery(QueryMessage query, ProcessingContext context, int updateBufferSize) Sends the givenqueryto the remote QueryBus.Methods inherited from class org.axonframework.messaging.queryhandling.distributed.DelegatingQueryBusConnector
subscribe, unsubscribe
-
Constructor Details
-
PayloadConvertingQueryBusConnector
public PayloadConvertingQueryBusConnector(@Nonnull QueryBusConnector delegate, @Nonnull MessageConverter converter, @Nonnull Class<?> targetType) Initialize thePayloadConvertingConnectorto use givenconverterto convert each Message's payload intotargetTypebefore passing it to givendelegate.- Parameters:
delegate- The delegate to pass converted messages to.converter- The converter to use to convert each Message's payload.targetType- The desired representation of forwarded Message's payload.
-
-
Method Details
-
query
@Nonnull public MessageStream<QueryResponseMessage> query(@Nonnull QueryMessage query, @Nullable ProcessingContext context) Description copied from interface:QueryBusConnectorSends the givenqueryto the remote QueryBus.- Specified by:
queryin interfaceQueryBusConnector- Overrides:
queryin classDelegatingQueryBusConnector- Parameters:
query- The query to send to the remote QueryBus.context- The context, if available, in which the query is generated- Returns:
- the stream of responses for the query
- See Also:
-
subscriptionQuery
@Nonnull public MessageStream<QueryResponseMessage> subscriptionQuery(@Nonnull QueryMessage query, @Nullable ProcessingContext context, int updateBufferSize) Description copied from interface:QueryBusConnectorSends the givenqueryto the remote QueryBus.- Specified by:
subscriptionQueryin interfaceQueryBusConnector- Overrides:
subscriptionQueryin classDelegatingQueryBusConnector- Parameters:
query- The query to send to the remote QueryBus.context- The context, if available, in which the query is generatedupdateBufferSize- The size of the buffer used to store update for the subscription query.- Returns:
- the stream of responses for the query
- See Also:
-
onIncomingQuery
Description copied from interface:QueryBusConnectorRegisters a handler to process incoming query messages.- Specified by:
onIncomingQueryin interfaceQueryBusConnector- Overrides:
onIncomingQueryin classDelegatingQueryBusConnector- Parameters:
handler- The handler responsible for managing incoming queries.
-
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- Overrides:
describeToin classDelegatingQueryBusConnector- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-