Send cancellation messages from the Operations service to a RabbitMQ exchange
Context
Currently the only way to communicate that execution of an Action should be cancelled is by updating the database and then waiting for a Bots service which has a worker executing the Action to recheck the state of the Job in the database.
This means that cancellation is limited by database connection availability, and is also a more complex communication method than is really necessary. The Operations service should support sending Job IDs to a RabbitMQ exchange, called something like operation-cancellation
, as a way of notifying other services that cancellation of an Job's execution has been requested.
Solution Starting Point
See the cancellation code in the prototype. Note that in the prototype the Operation name is also the relevant Action digest, which will likely not be the case in a final implementation.
The real Operations service also needs to handle only cancelling the Action if all Operations for that Action are cancelled, so probably wants to maintain a set of active Operations for a given Action and remove them as appropriate.
Acceptance Criteria
The Operations service supports connecting to RabbitMQ and sending messages to an exchange when cancellation of that Action is requested.
Consider whether the following are required, and complete if so:
-
Unit tests -
Metrics -
Documentation update(s)