Class CommandSerializer

java.lang.Object
org.axonframework.axonserver.connector.command.CommandSerializer

public class CommandSerializer extends Object
Converter between Axon Framework CommandMessages and Axon Server gRPC Command messages.
Since:
4.0
Author:
Marc Gathier
  • Constructor Details

  • Method Details

    • serialize

      public io.axoniq.axonserver.grpc.command.Command serialize(CommandMessage<?> commandMessage, String routingKey, int priority)
      Convert a 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.
      Parameters:
      commandMessage - the CommandMessage to convert into a Command
      routingKey - a String defining the routing key of the given CommandMessage
      priority - a int defining the priority of the given CommandMessage
      Returns:
      a Command based on the provided commandMessage
    • serialize

      public io.axoniq.axonserver.grpc.command.CommandResponse serialize(CommandResultMessage<?> commandResultMessage, String requestIdentifier)
      Convert a CommandResultMessage into a CommandProviderOutbound.
      Parameters:
      commandResultMessage - the CommandResultMessage to convert into a CommandProviderOutbound
      requestIdentifier - a String identifying where the original request came from
      Returns:
      a CommandProviderOutbound based on the provided commandResultMessage
    • deserialize

      public CommandMessage<?> deserialize(io.axoniq.axonserver.grpc.command.Command command)
      Convert a Command into a CommandMessage.
      Parameters:
      command - the Command to convert into a CommandMessage
      Returns:
      a CommandMessage based on the provided command
    • deserialize

      public <R> CommandResultMessage<R> deserialize(io.axoniq.axonserver.grpc.command.CommandResponse commandResponse)
      Convert a CommandResponse into a CommandResultMessage.
      Type Parameters:
      R - a generic specifying the response payload type
      Parameters:
      commandResponse - the CommandResponse to convert into a CommandResultMessage
      Returns:
      a CommandResultMessage of generic R based on the provided commandResponse