Did POC on distributed saga with spring boot applications for order & shipment. Implemented ShipmentSaga. Getting below exception -WARN 13472 --- [nd-processor]-0] o.a.c.gateway.DefaultCommandGateway : Command 'com.techm.bm.api.cmd.RegisterShipmentForOrderPreparedCmd' resulted in org.axonframework.eventsourcing.IncompatibleAggregateException(Aggregate identifier must be non-null after applying an event. Make sure the aggregate identifier is initialized at the latest when handling the creation event.) Pls suggest what is wrong with code - gitlab.com/bm-cqrs/axon-kafka-distrbuted
What I am trying to acieve is, interactive microsercices that would listen to each other’s event.
Detailed problem statement is posted on below stackoverflow-
I have provided a MR on your repo: https://gitlab.com/bm-cqrs/axon-kafka-distrbuted/merge_requests/1/commits
First commit fixes Maven configuration (this can be a source of many mistakes - you had wrong/bad artifact ids of modules - try to empty your local maven repo, and see what will happen).
Second commit fixes
application.yml Kafka configurations (
improvements I was able to run your application/s successfully:
curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ ‘http://localhost:9001/bm/command/order/placeOrder?destination=dest1&goods=goods1’
curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: /’ ‘http://localhost:9002/bm/command/shipment/registerArrival?shipmentId=e70f1d17-ca44-49ac-8cbc-8ca112a85db3’
Note: CHANGE shipmentId=e70f1d17-ca44-49ac-8cbc-8ca112a85db3 to match your scenario !!!
I hope this helps !
If all consumers are from the same group, the Kafka model functions as a traditional message queue would. All the records and processing is then load balanced. Each message would be consumed by one consumer of the group only.Each partition is connected to at most one consumer from a group.
When multiple consumer groups exist, the flow of the data consumption model aligns with the traditional publish-subscribe model. The messages are broadcast to all consumer groups.
You can use publish-subscribe model, by setting unique consumer group id for each (micro)service.
Ivan, appreciate your detailed response and code correction. Its working, Thanks !!