Hi Jose If I understand your problem correctly, the issue is that you need to decrement the stock count when you reserve it, rather than splitting it into a second phase. You can do this via the DSL with a Transfomer. There's a related example below. Alternatively you could do it with the processor API. As Michael suggested, you can now do this atomically with the EoS feature.
Hi Chris Kafka Streams provides the index that gives you the findByPk semantic. Although for high performance use cases the Kafka broker is often used, alone, via the Memory Image approach. B https://github.com/confluentinc/examples/blob/master/kafka-streams/src/test/java/io/confluent/examples/streams/StateStoresInTheDSLIntegrationTest.java https://martinfowler.com/bliki/MemoryImage.html On Fri, Jul 21, 2017 at 3:15 PM Michal Borowiecki < michal.borowie...@openbet.com> wrote: > With Kafka Streams you get those and atomicity via Exactly-once-Semantics. > > Michał > > > On 21/07/17 14:51, Chris Richardson wrote: > > Hi, > > > > I like Kafka but I don't understand the claim that it can be used for > Event > > Sourcing (here < > http://microservices.io/patterns/data/event-sourcing.html> > > and here <https://martinfowler.com/eaaDev/EventSourcing.html>) > > > > One part of the event sourcing is the ability to subscribe to events > > published by aggregates and clearly Kafka works well there. > > > > But the other part of Event Sourcing is "database" like functionality, > > which includes > > > > - findEventsByPrimaryKey() - needed to be able to reconstruct an > > aggregate from its events - the essence of event sourcing > > - Atomic updates - for updating aggregates - > findEventsByPrimaryKey() > > - business logic - insertNewEvents()) in order to handle this kind of > > scenario. > > > > The approach we have taken is to implement event sourcing using a > database > > and Kafka. > > For instance: see > > > https://blog.eventuate.io/2016/10/06/eventuate-local-event-sourcing-and-cqrs-with-spring-boot-apache-kafka-and-mysql/ > > > > Chris > > > > -- > Signature > Michal Borowiecki <http://www.openbet.com/> > *Senior Software Engineer L4* > *T:* +44 208 742 1600 <+44%2020%208742%201600> < > https://signature.openbet/cgi-bin/signature.php#> > > *E:* michal.borowie...@openbet.com > <https://signature.openbet/cgi-bin/signature.php#> > *DL: * +44 203 249 8448 <+44%2020%203249%208448> > <https://signature.openbet/cgi-bin/signature.php#> > > *W:* www.openbet.com < > https://signature.openbet/cgi-bin/signature.php#> > ** > > > ** > > <https://www.openbet.com/com/email_promo> > This message is confidential and intended only for the addressee. If you > have received this message in error, please immediately notify the > postmas...@openbet.com <mailto:postmas...@openbet.com> and delete it > from your system as well as any copies. The content of e-mails as well > as traffic data may be monitored by OpenBet for employment and security > purposes. To protect the environment please do not print this e-mail > unless necessary. OpenBet Ltd. Registered Office: Chiswick Park Building > 9, 566 Chiswick High Road, London, W4 5XT, United Kingdom. A company > registered in England and Wales. Registered no. 3134634. VAT no. > GB927523612 > >