Invoice Numbering

79 views
Skip to first unread message

Michal Talaga

unread,
Dec 21, 2014, 8:26:54 PM12/21/14
to event...@googlegroups.com
Working on a booking system I need to implement invoice numbering.

Invoice numbers must be sequential and with no gaps. i.e. 1, 2, 3 - is ok. 1, 3, 4 - is not ok.


In my present CRUD implementation I do a Lock, query over invoices table, generate new number, save and unlock.


How do you normally go about it? It must be a common scenario in many systems.

I could use a technique suggested in my other thread on scheduling: (https://groups.google.com/forum/#!topic/event-store/o_Y2exIxNZM)
i.e. introduce Invoicing aggregate to accept and number the invoice and then use Saga/ProcessManager to issue command to create the actual invoice.

Is this the best I can do or are there simpler solutions here?

Greg Young

unread,
Dec 21, 2014, 8:27:37 PM12/21/14
to event...@googlegroups.com
Put invoices in a stream, use event id generated in that stream (they
are synchronous)
> --
> You received this message because you are subscribed to the Google Groups
> "Event Store" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to event-store...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Studying for the Turing test

Michal Talaga

unread,
Dec 22, 2014, 6:46:26 AM12/22/14
to event...@googlegroups.com
Shouldn't I have 1 stream per aggregate?
What if i need to change the sate of the invoice - for example: IsPaid? That's one more event in the stream.
Reply all
Reply to author
Forward
0 new messages