public class CommandSerializer extends Object
CommandMessages and Axon Server gRPC Command messages.| Constructor and Description |
|---|
CommandSerializer(Serializer serializer,
AxonServerConfiguration configuration)
Instantiate a serializer used to convert Axon
CommandMessages and CommandResultMessages into Axon
Server gRPC messages and vice versa. |
| Modifier and Type | Method and Description |
|---|---|
CommandMessage<?> |
deserialize(Command command)
Convert a
Command into a CommandMessage. |
<R> CommandResultMessage<R> |
deserialize(CommandResponse commandResponse)
Convert a
CommandResponse into a CommandResultMessage. |
Command |
serialize(CommandMessage<?> commandMessage,
String routingKey,
int priority)
Convert a
CommandMessage into a Command. |
CommandProviderOutbound |
serialize(CommandResultMessage<?> commandResultMessage,
String requestIdentifier)
Convert a
CommandResultMessage into a CommandProviderOutbound. |
public CommandSerializer(Serializer serializer, AxonServerConfiguration configuration)
CommandMessages and CommandResultMessages into Axon
Server gRPC messages and vice versa.
The provided serializer is used for both from and to framework-server conversions.serializer - a Serializer used to de-/serialize an Axon Server gRPC message into a CommandMessage or CommandResultMessage and vice versaconfiguration - an AxonServerConfiguration used to set the configurable component id and name in the
messagespublic Command serialize(CommandMessage<?> commandMessage, String routingKey, int priority)
CommandMessage into a Command. The routingKey and priority
respectively define which service to route the command to and what the command's priority among others is.commandMessage - the CommandMessage to convert into a CommandroutingKey - a String defining the routing key of the given CommandMessagepriority - a int defining the priority of the given CommandMessageCommand based on the provided commandMessagepublic CommandProviderOutbound serialize(CommandResultMessage<?> commandResultMessage, String requestIdentifier)
CommandResultMessage into a CommandProviderOutbound.commandResultMessage - the CommandResultMessage to convert into a CommandProviderOutboundrequestIdentifier - a String identifying where the original request came fromCommandProviderOutbound based on the provided commandResultMessagepublic CommandMessage<?> deserialize(Command command)
Command into a CommandMessage.command - the Command to convert into a CommandMessageCommandMessage based on the provided commandpublic <R> CommandResultMessage<R> deserialize(CommandResponse commandResponse)
CommandResponse into a CommandResultMessage.R - a generic specifying the response payload typecommandResponse - the CommandResponse to convert into a CommandResultMessageCommandResultMessage of generic R based on the provided commandResponseCopyright © 2010–2020. All rights reserved.