Sending command to Axon Server using gRPC

Hi

We’re looking at a third party app sending commands to our Axon Server as an integration option…

The third party tech is .NET

Can anyone help with details on using gRCP to send commands to Axon Server?

I’ve made a start and connect to the server but I’m getting an error when I send the command (actually there is a NPE in Axon Server)

Can someone advise what values I should provide in the command ( from the proto)??

message Command {
/* A message id */
string message_identifier = 1;
string name = 2;
int64 timestamp = 3;
SerializedObject payload = 4;
map<string, MetaDataValue> meta_data = 5;
repeated ProcessingInstruction processing_instructions = 6;
string client_id = 7;
string component_name = 8;
}

Thanks
Michael
Greater Bank

Hi Michael,

here’s a brief explanation for each field. Please do provide the NPE tracktrace if you still have it. We shouldn’t be throwing those randomly around.

message Command {
/* The identifier, uniquely identifying this message /
string message_identifier = 1;
/
The name of the command. In Axon, this defaults to the fully qualified class name, but may be overridden /
string name = 2;
/
Time at which the command was dispatched to AxonServer. /
int64 timestamp = 3;
/
The serialized representation of the command. /
SerializedObject payload = 4;
/
Any application specific meta data elements contained in the command message*/
map<string, MetaDataValue> meta_data = 5;
/* Processing instructions provide information to AxonServer on how to dispatch the message /
/
Set ROUTING_KEY to the aggregate identifier (or other routing key, if not default) the command targets for consistent routing*/
repeated ProcessingInstruction processing_instructions = 6;
/* Uniquely identifies the instance of the dispatching component. Used for monitoring and routing statistics. /
string client_id = 7;
/
The name of the component. Used for monitoring and routing statistics. */
string component_name = 8;
}

You can check the CommandSerializer class in the axon-server-connector module of AxonFramework for details on how Axon messages are transformed into gRPC/protobuf messages.

Note that you can also use the HTTP endpoints to dispatch commands. It doesn’t perform as well as the gRPC one, but may be easier to implement.
Check Swagger for details (assuming AxonServer runs on localhost, visit: http://localhost:8024/swagger-ui.html#/command-rest-controller)

I hope this helps.
Cheers,

Thanks Allard,

I’ve tried the REST API and all working fine, thanks.