Class GrpcBackedCommandMessage<C>
java.lang.Object
org.axonframework.axonserver.connector.command.GrpcBackedCommandMessage<C>
- Type Parameters:
C- a generic specifying the payload type of the wrappedCommandMessage
- All Implemented Interfaces:
Serializable,CommandMessage<C>,Message<C>
Wrapper that allows clients to access a gRPC
Command as a CommandMessage.- Since:
- 4.0
- Author:
- Marc Gathier
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGrpcBackedCommandMessage(io.axoniq.axonserver.grpc.command.Command command, Serializer serializer) Instantiate aGrpcBackedCommandMessagewith the givencommandand using the providedSerializerto be able to retrieve the payload andMetaDatafrom it. -
Method Summary
Modifier and TypeMethodDescriptionandMetaData(Map<String, ?> metaData) Returns a copy of this CommandMessage with it MetaData merged with the givenmetaData.Returns the name of the command to execute.Returns the identifier of this message.Returns the meta data for this message.Returns the payload of this message.Returns the type of the payload.withMetaData(Map<String, ?> metaData) Returns a copy of this CommandMessage with the givenmetaData.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.Message
serializeMetaData, serializePayload
-
Constructor Details
-
GrpcBackedCommandMessage
public GrpcBackedCommandMessage(io.axoniq.axonserver.grpc.command.Command command, Serializer serializer) Instantiate aGrpcBackedCommandMessagewith the givencommandand using the providedSerializerto be able to retrieve the payload andMetaDatafrom it.- Parameters:
command- theCommandwhich is being wrapped as aCommandMessageserializer- theSerializerused to deserialize the payload andMetaDatafrom the givencommand
-
-
Method Details
-
getCommandName
Description copied from interface:CommandMessageReturns the name of the command to execute. This is an indication of what should be done, using the payload as parameter.- Specified by:
getCommandNamein interfaceCommandMessage<C>- Returns:
- the name of the command
-
getIdentifier
Description copied from interface:MessageReturns the identifier of this message. Two messages with the same identifiers should be interpreted as different representations of the same conceptual message. In such case, the meta-data may be different for both representations. The payload may be identical.- Specified by:
getIdentifierin interfaceMessage<C>- Returns:
- the unique identifier of this message
-
getMetaData
Description copied from interface:MessageReturns the meta data for this message. This meta data is a collection of key-value pairs, where the key is a String, and the value is a serializable object.- Specified by:
getMetaDatain interfaceMessage<C>- Returns:
- the meta data for this message
-
getPayload
Description copied from interface:MessageReturns the payload of this message. The payload is the application-specific information.- Specified by:
getPayloadin interfaceMessage<C>- Returns:
- the payload of this message
-
getPayloadType
Description copied from interface:MessageReturns the type of the payload. Is semantically equal togetPayload().getClass(), but allows implementations to optimize by using lazy loading or deserialization.- Specified by:
getPayloadTypein interfaceMessage<C>- Returns:
- the type of payload.
-
withMetaData
Description copied from interface:CommandMessageReturns a copy of this CommandMessage with the givenmetaData. The payload remains unchanged. While the implementation returned may be different than the implementation ofthis, implementations must take special care in returning the same type of Message (e.g. EventMessage, DomainEventMessage) to prevent errors further downstream.- Specified by:
withMetaDatain interfaceCommandMessage<C>- Specified by:
withMetaDatain interfaceMessage<C>- Parameters:
metaData- The new MetaData for the Message- Returns:
- a copy of this message with the given MetaData
-
andMetaData
Description copied from interface:CommandMessageReturns a copy of this CommandMessage with it MetaData merged with the givenmetaData. The payload remains unchanged.- Specified by:
andMetaDatain interfaceCommandMessage<C>- Specified by:
andMetaDatain interfaceMessage<C>- Parameters:
metaData- The MetaData to merge with- Returns:
- a copy of this message with the given MetaData
-