StreamSubscriptionActor throws CommandNotExpectedException but eventually delivers the event

Hi,

I’m experiencing strange behavior of StreamSubscriptionActor that I’m using in ViewUpdater component on akka-ddd project (https://github.com/pawelkaczor/akka-ddd/blob/master/view-update/src/main/scala/pl/newicom/dddd/view/ViewUpdater.scala) . Initially it throws an exception (see log below) that results in subscription restart. After the restart the event is processed as expected. I’m using EventStore.JVM fork (https://github.com/pawelkaczor/EventStore.JVM) that was built against Akka 2.4-SNAPSHOT.

Log message containing exception:

10:30:09.879UTC ERROR pl.newicom.dddd.view.ViewUpdater - Failure: eventstore.CommandNotExpectedException: Expected: StreamEventAppeared, actual:

StreamEventAppeared(
IndexedEvent(
ResolvedEvent(
EventRecord(
Stream(Reservation-r1),
EventNumber(0),
EventData(
ecommerce.sales.ReservationCreated,
e376360c-4fed-4af6-9c76-71c71b6416c9,
Content(ByteString(123,…),ContentType.Binary),
Content(ByteString(123,…),ContentType.Binary)),
Some(2015-03-16T10:47:49.825+01:00)),
EventRecord(
SystemStream($ce-Reservation),
EventNumber(0),
EventData(
$>,
45d46157-b8bf-f8d4-0664-4067a704d59b,
Content(ByteString(48,…),ContentType.Binary),
Content(ByteString(123,),ContentType.Binary)),
Some(2015-03-16T10:47:49.832+01:00))),
Position(186722)))

``

You can reproduce the error by running sample e-commerce system I developed (https://github.com/pawelkaczor/ddd-leaven-akka-v2) and executing CreateReservation command as shown here: https://github.com/pawelkaczor/ddd-leaven-akka-v2#manual-testing.

Please help me to figure out what is going on here.

Pawel

I created a test (https://github.com/pawelkaczor/akka-ddd/blob/master/view-update-sql/src/test/scala/pl/newicom/dddd/view/sql/SqlViewUpdateServiceIntegrationSpec.scala) that can be used to reproduce the error.

Looks like exception is thrown by EventStore.JVM only after subscription switched to live mode (eventstore.LiveProcessingStarted occurred).

Detailed log can be found here: https://github.com/pawelkaczor/akka-ddd/issues/1

Pawel

Hi Pawel, I found the cause. will release a fix soon. Thanks for reporting :slight_smile:

Thanks Yaroslav!

Cheers,

Pawel

Hi Yaroslav,

can you give us some more insights ?

https://github.com/EventStore/EventStore.JVM/issues/31

is tracking it.

Thanks Greg