Class CommandSerializer
java.lang.Object
org.axonframework.axonserver.connector.command.CommandSerializer
Converter between Axon Framework
CommandMessages and Axon Server gRPC Command messages.- Since:
- 4.0
- Author:
- Marc Gathier
-
Constructor Summary
ConstructorsConstructorDescriptionCommandSerializer(Serializer serializer, AxonServerConfiguration configuration) Instantiate a serializer used to convert AxonCommandMessages andCommandResultMessages into Axon Server gRPC messages and vice versa. -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(io.axoniq.axonserver.grpc.command.Command command) Convert aCommandinto aCommandMessage.<R> CommandResultMessage<R> deserialize(io.axoniq.axonserver.grpc.command.CommandResponse commandResponse) Convert aCommandResponseinto aCommandResultMessage.io.axoniq.axonserver.grpc.command.Commandserialize(CommandMessage<?> commandMessage, String routingKey, int priority) Convert aCommandMessageinto aCommand.io.axoniq.axonserver.grpc.command.CommandResponseserialize(CommandResultMessage<?> commandResultMessage, String requestIdentifier) Convert aCommandResultMessageinto aCommandProviderOutbound.
-
Constructor Details
-
CommandSerializer
Instantiate a serializer used to convert AxonCommandMessages andCommandResultMessages into Axon Server gRPC messages and vice versa. The providedserializeris used for both from and to framework-server conversions.- Parameters:
serializer- aSerializerused to de-/serialize an Axon Server gRPC message into aCommandMessageorCommandResultMessageand vice versaconfiguration- anAxonServerConfigurationused to set the configurable component id and name in the messages
-
-
Method Details
-
serialize
public io.axoniq.axonserver.grpc.command.Command serialize(CommandMessage<?> commandMessage, String routingKey, int priority) Convert aCommandMessageinto aCommand. TheroutingKeyandpriorityrespectively define which service to route the command to and what the command's priority among others is.- Parameters:
commandMessage- theCommandMessageto convert into aCommandroutingKey- aStringdefining the routing key of the givenCommandMessagepriority- aintdefining the priority of the givenCommandMessage- Returns:
- a
Commandbased on the providedcommandMessage
-
serialize
public io.axoniq.axonserver.grpc.command.CommandResponse serialize(CommandResultMessage<?> commandResultMessage, String requestIdentifier) Convert aCommandResultMessageinto aCommandProviderOutbound.- Parameters:
commandResultMessage- theCommandResultMessageto convert into aCommandProviderOutboundrequestIdentifier- aStringidentifying where the original request came from- Returns:
- a
CommandProviderOutboundbased on the providedcommandResultMessage
-
deserialize
Convert aCommandinto aCommandMessage.- Parameters:
command- theCommandto convert into aCommandMessage- Returns:
- a
CommandMessagebased on the providedcommand
-
deserialize
public <R> CommandResultMessage<R> deserialize(io.axoniq.axonserver.grpc.command.CommandResponse commandResponse) Convert aCommandResponseinto aCommandResultMessage.- Type Parameters:
R- a generic specifying the response payload type- Parameters:
commandResponse- theCommandResponseto convert into aCommandResultMessage- Returns:
- a
CommandResultMessageof genericRbased on the providedcommandResponse
-