public class CommandSerializer extends Object
CommandMessage
s and Axon Server gRPC Command
messages.Constructor and Description |
---|
CommandSerializer(Serializer serializer,
AxonServerConfiguration configuration)
Instantiate a serializer used to convert Axon
CommandMessage s and CommandResultMessage s into Axon
Server gRPC messages and vice versa. |
Modifier and Type | Method and Description |
---|---|
CommandMessage<?> |
deserialize(io.axoniq.axonserver.grpc.command.Command command)
Convert a
Command into a CommandMessage . |
<R> CommandResultMessage<R> |
deserialize(io.axoniq.axonserver.grpc.command.CommandResponse commandResponse)
Convert a
CommandResponse into a CommandResultMessage . |
io.axoniq.axonserver.grpc.command.Command |
serialize(CommandMessage<?> commandMessage,
String routingKey,
int priority)
Convert a
CommandMessage into a Command . |
io.axoniq.axonserver.grpc.command.CommandResponse |
serialize(CommandResultMessage<?> commandResultMessage,
String requestIdentifier)
Convert a
CommandResultMessage into a CommandProviderOutbound . |
public CommandSerializer(Serializer serializer, AxonServerConfiguration configuration)
CommandMessage
s and CommandResultMessage
s 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 io.axoniq.axonserver.grpc.command.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 Command
routingKey
- a String
defining the routing key of the given CommandMessage
priority
- a int
defining the priority of the given CommandMessage
Command
based on the provided commandMessage
public io.axoniq.axonserver.grpc.command.CommandResponse serialize(CommandResultMessage<?> commandResultMessage, String requestIdentifier)
CommandResultMessage
into a CommandProviderOutbound
.commandResultMessage
- the CommandResultMessage
to convert into a CommandProviderOutbound
requestIdentifier
- a String
identifying where the original request came fromCommandProviderOutbound
based on the provided commandResultMessage
public CommandMessage<?> deserialize(io.axoniq.axonserver.grpc.command.Command command)
Command
into a CommandMessage
.command
- the Command
to convert into a CommandMessage
CommandMessage
based on the provided command
public <R> CommandResultMessage<R> deserialize(io.axoniq.axonserver.grpc.command.CommandResponse commandResponse)
CommandResponse
into a CommandResultMessage
.R
- a generic specifying the response payload typecommandResponse
- the CommandResponse
to convert into a CommandResultMessage
CommandResultMessage
of generic R
based on the provided commandResponse
Copyright © 2010–2023. All rights reserved.