ConcurrencyException: OUT_OF_RANGE sequence number: 0, expecting: 1

96 views
Skip to first unread message

Justin Tilson

unread,
Dec 6, 2017, 6:38:24 PM12/6/17
to Axon Framework Users
I'm working on a trivial create / update example using the AxonIQ EventStore. My create functionality works 100%. Update mostly works (read model gets updated) but I get this in my output and logs:

{"timestamp":1512549981707,"status":500,"error":"Internal Server Error","exception":"org.axonframework.commandhandling.model.ConcurrencyException","message":"OUT_OF_RANGE: [AXONIQ-2000] Invalid sequence number: 0 for aggregateId: f73d46d6-644e-4022-aa49-55bf886fd6f9 expecting: 1","path":"/status-type/f73d46d6-644e-4022-aa49-55bf886fd6f9"}

The sequence number is not being incremented. I thought this happened transparently behind the scenes?

Steps:

1. Create a new thing (generates new aggregate id)
2. Try to update the thing (using same aggregate id)

I have distinct Create and Update events.

Any suggestions?

Justin Tilson

unread,
Dec 6, 2017, 9:37:35 PM12/6/17
to Axon Framework Users
From looking at this more, it appears the the EventBus part of the AxonIQ EventStore is working fine but the EventStore append is failing because the sequence number isn't incrementing.

Allard Buijze

unread,
Dec 7, 2017, 3:13:12 AM12/7/17
to axonfr...@googlegroups.com
Hi Justin,

this looks like an issue in your setup. Could you share your Aggregate command handlers? Sequence number 0 should only be used for newly created aggregate instances. Once an aggregate is loaded, Axon will automatically increment the sequence number.

The Event Store is just validating that you're using "legal" sequence numbers. It won't generate them for you.

Cheers,

Allard

Op do 7 dec. 2017 om 03:37 schreef Justin Tilson <justin...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Justin Tilson

unread,
Dec 7, 2017, 7:46:08 AM12/7/17
to Axon Framework Users
I think I must be missing the "once an aggregate is loaded part" on my update/delete.

Here is a sample Aggregate: https://pastebin.com/1AJ8h8YX 

My goal is to get a very basic CRUD example working so I understand how the Axon plumbing works.

thx
Justin

Allard Buijze

unread,
Dec 7, 2017, 7:56:07 AM12/7/17
to axonfr...@googlegroups.com
Hi Justin,

exactly what I thought: both your @CommandHandler methods are constructors. Your update command is probably expected to be executed on an existing aggregate, not on a freshly created one. In that case, make it a regular method.

Cheers,

Allard

Op do 7 dec. 2017 om 13:46 schreef Justin Tilson <justin...@gmail.com>:

Justin Tilson

unread,
Dec 7, 2017, 9:46:28 AM12/7/17
to Axon Framework Users

Justin Tilson

unread,
Dec 7, 2017, 11:23:55 AM12/7/17
to Axon Framework Users
THANK-YOU so much Allard. I am now up and running.
Reply all
Reply to author
Forward
0 new messages