Open kthompson opened 2 months ago
I have the same issue
It seems that when setting the eventStore property, this
represents an EventStore
and not a ConnectedEventStore
https://github.com/castore-dev/castore/blob/c9b9beab799ae0cf3d1ccd6a06ae93272305742d/packages/core/src/eventStore/eventStore.ts#L221
Yea my work around has been to do something like....
const event = eventStore.groupEvent({
// ....
});
event.eventStore = eventStore;
Where eventStore
is your connected event store.
Describe the bug When using a ConnectedEventStore that is connected to a message bus, the message bus does not receive events that are created via the
EventStore.pushEventGroup
method.This seems to occur because
onEventPushed
is never called because when the GroupEvent is created, the eventStore that is attached to it is the inner EventStore rather than the ConnectedEventStore.I think overriding the
groupEvent
method inConnectedEventStore
to assign the connectedEventStore after the GroupEvent is created would resolve this.To Reproduce Steps to reproduce the behavior:
bus
instance of MessageBus implementation ofNotificationMessageBus<ProductEventStore>
connected
instance ofProductEventStore
, ie `new ConnectedEventStore(ProductEventStore, bus);EventStore.pushGroupEvent(...)
bus
Expected behavior We should see all of the events that were pushed come into the bus. They get committed to the EventStore but are not seen on the bus.
Additional context You can work around the issue by assigning the connected bus for each group event created. ie: