C
- a generic specifying the payload type of the wrapped CommandMessage
public class GrpcBackedCommandMessage<C> extends Object implements CommandMessage<C>
Command
as a CommandMessage
.Constructor and Description |
---|
GrpcBackedCommandMessage(io.axoniq.axonserver.grpc.command.Command command,
Serializer serializer)
Instantiate a
GrpcBackedCommandMessage with the given command and using the provided Serializer to be able to retrieve the payload and MetaData from it. |
Modifier and Type | Method and Description |
---|---|
GrpcBackedCommandMessage<C> |
andMetaData(Map<String,?> metaData)
Returns a copy of this CommandMessage with it MetaData merged with the given
metaData . |
String |
getCommandName()
Returns the name of the command to execute.
|
String |
getIdentifier()
Returns the identifier of this message.
|
MetaData |
getMetaData()
Returns the meta data for this message.
|
C |
getPayload()
Returns the payload of this message.
|
Class<C> |
getPayloadType()
Returns the type of the payload.
|
GrpcBackedCommandMessage<C> |
withMetaData(Map<String,?> metaData)
Returns a copy of this CommandMessage with the given
metaData . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
serializeMetaData, serializePayload
public GrpcBackedCommandMessage(io.axoniq.axonserver.grpc.command.Command command, Serializer serializer)
GrpcBackedCommandMessage
with the given command
and using the provided Serializer
to be able to retrieve the payload and MetaData
from it.command
- the Command
which is being wrapped as a CommandMessage
serializer
- the Serializer
used to deserialize the payload and MetaData
from the given
command
public String getCommandName()
CommandMessage
getCommandName
in interface CommandMessage<C>
public String getIdentifier()
Message
getIdentifier
in interface Message<C>
public MetaData getMetaData()
Message
getMetaData
in interface Message<C>
public C getPayload()
Message
getPayload
in interface Message<C>
public Class<C> getPayloadType()
Message
getPayload().getClass()
, but allows implementations to optimize by using lazy
loading or deserialization.getPayloadType
in interface Message<C>
public GrpcBackedCommandMessage<C> withMetaData(@Nonnull Map<String,?> metaData)
CommandMessage
metaData
. The payload remains unchanged.
While the implementation returned may be different than the implementation of this
, implementations
must take special care in returning the same type of Message (e.g. EventMessage, DomainEventMessage) to prevent
errors further downstream.withMetaData
in interface CommandMessage<C>
withMetaData
in interface Message<C>
metaData
- The new MetaData for the Messagepublic GrpcBackedCommandMessage<C> andMetaData(@Nonnull Map<String,?> metaData)
CommandMessage
metaData
. The payload
remains unchanged.andMetaData
in interface CommandMessage<C>
andMetaData
in interface Message<C>
metaData
- The MetaData to merge withCopyright © 2010–2024. All rights reserved.