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
Persistent subscriptions #38
Persistent subscriptions #38
Conversation
Please add any feedback for this pull request. I tried to follow the existing coding style & conventions. |
Great job @slashdotdash, we appreciate it! I don't like the fact that new Extreme connection needs to be started for persistent subscription but I understand that's up to EventStore itself. |
Thanks for merging this. Yes, the connection per persistent subscription is a due to how the Event Store tracks active consumers. |
Event Store provides an alternate event subscription model, from version 3.2.0, known as competing consumers. Instead of the client holding the state of the subscription, the server remembers it.
This pull request adds support for creating a new persistent connection and connecting a subscriber to a persistent connection. Additional unit tests have been included to demonstrate and verify these new features.
Each persistent subscription runs as a separate GenServer process,
Extreme.PersistentSubscription
, and creates its own connection to the Event Store. This is due to the way that the Event Store tracks active consumers for a persistent subscription by connection. It is not possible to reuse a single connection to reconnect to a subscription if the subscriber process terminates. The connection must close to notify the Event Store that the consumer is dead. Then it will allow a new connection to the subscription.It includes a breaking change. The module
Extreme.Messages
has been renamed toExtreme.Msg
. This is due to the persistent connection messages in the Protocol Buffers definition creating an Elixir module name that exceeds the 100 character limit support for creating Erlang releases.I have incremented the mix release version to
0.9.0
.