Skip to content

Executing commands

skovzhaw edited this page Jul 5, 2016 · 52 revisions

Configuration

Every micro service is listening on two RabbitMQ queues, one for data ingestion and second for command execution.

Command execution

You could ask why do we need commands at all? As we may be running more than just one instance of the individual micro services, or we might want to control the flow of the data (like batch processing with "flush" commands), we need to make sure only one micro service executes the following command.

In order to execute your desired command, simply send a valid JSON command over micro service's RabbitMQ commands queue, specified in your configuration file.

As an example you could take Billing micro service's invoice generation commands.

Develop your own

If you decide to implement your own command, first select which micro service should be executing it. Let's say you are designing an event processing command for your UDR micro service, then proceed by creating a new class that inherits from Commands parent class, has name that corresponds with _class JSON field, and Java class file is located in:

/core/udr/src/main/java/ch/icclab/cyclops/consume/command/model/

Now you can start developing your command and if you need to pass some arguments, simply register them in the Java class the same way as you would do it in a POJO class, where those object variables will be filled based on their corresponding JSON fields, or left as null/defaults.

Clone this wiki locally