Axon Unit Of Work

Hi,

Are you using Spring? How did you configure your Axon components?
Did you check if your command was rolled back for some reason (make sure to use or log the result of commandGateway.send(…)).

If you want to execute everything in one transaction (which is not recommended to depend on!), you should use the SimpleCommandBus (default) and subscribing event processors (also default).

Cheesr,

Allard

Seems like I forgot to put @StartSaga.

Anyway, you said that it is not recommended to depend on transaction here. I just wanted to process message from AMQP, and during message processing activate aggregate (which will change state and emit new events to saga) and this 1 saga that will react to aggregate events and prepare commands to be sent further to AMQP. If complete process (aggregate and saga) fails, message would be redelivered since I’m using rabbitmq transaction, and if all OK, state in DB will be saved and message sent down the stream. Is there any other pattern I could use here?

Hi Bojan,

what I meant with “not relying on a single transaction”, is that you implementation code (i.e. the business logic) should not assume that an event published is also being handled in the same transaction. If at some point you decide to make the SagaManager track the event store instead of processing events in the same transaction, you should be able to do so, without changing any other configuration.
As soon as components rely on others being executed in the same transaction, you’re likely to run into trouble in the future.

Hope that makes sense.
Cheers,

Allard