Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MongoDBEventStore] Feature - Basic implementation of MongoDBEventStoreConsumer #214

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alex-laycalvert
Copy link
Collaborator

Description

  • My attempt at implementing MongoDBEventStoreConsumer. The current impl. is just a basic pub/sub pattern and you can call consumer.publish inside of the onAfterCommit hook for your event store which will allow you to actually utilize the consumer.
  • Adds eventStore to the onAfterCommit handler context for convenience

I know the postgres impl. of consumers is more involved with batching, so there's definitely room to make this more robust.

Copy link
Collaborator

@oskardudycz oskardudycz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alex-laycalvert, as a general concept that looks good to me, thank you for doing that.

Yet, could you align the API with the current Consumers =>Processors API? See the EventStoreDB consumer as an example:

const consumer = eventStoreDBEventStoreConsumer({
connectionString,
from: from(streamName),
});
consumer.processor<GuestStayEvent>({
processorId: uuid(),
stopAfter: (event) =>
event.metadata.globalPosition ===
appendResult.lastEventGlobalPosition,
eachMessage: (event) => {
result.push(event);
},
});

It should be probably closer than PostgreSQL implementation.

I'm fine with starting with non-batched option, but I'd like to have at leas the API look similar, as that will need to be aligned eventually (and sooner than later, as I'm working on the common typing abstractions on that ATM in PR: #202

If the consumers and processors concept is unclear, I'm happy to explain that deeper here on on Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants