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

Subscription concurrency #134

Merged
merged 20 commits into from
Sep 18, 2018
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
11473c6
Initial concurrent subscription test
slashdotdash Jun 26, 2018
0f99966
Send events to multiple subscribers connected to a single subscription
slashdotdash Jun 26, 2018
a6069af
WIP In-flight subscriber message acknowledgement
slashdotdash Jun 26, 2018
2bf3c6a
Subscription monitors subscribers, terminates when all subscribers down
slashdotdash Jun 27, 2018
dd9c57f
Exclude events filtered by selector function
slashdotdash Jun 27, 2018
3109505
Prevent too many subscribers connecting to a subscription
slashdotdash Jun 27, 2018
0c88470
Subscriber buffer size
slashdotdash Jun 28, 2018
2e5cdd6
Ensure subscription last sent is initialised from last seen
slashdotdash Jun 28, 2018
3b93f2e
Subscription event partitioning
slashdotdash Jun 29, 2018
f087937
Attempt to notify partitioned events ordered by lowest event number
slashdotdash Jun 29, 2018
0cd0ffa
Subscription records `last_sent` for filtered events
slashdotdash Sep 1, 2018
e0e80a7
Request next batch of events when catching up and queue is empty
slashdotdash Sep 2, 2018
a6db11d
Extract subscription tests to test case
slashdotdash Sep 3, 2018
a06bc3e
Delete subscription
slashdotdash Sep 17, 2018
ace4451
Unsubscribe from stream and delete subscription tests
slashdotdash Sep 17, 2018
d971424
Document concurrent subscriptions
slashdotdash Sep 17, 2018
a019183
Acknowledgement of redistributed in-flight events after subscription …
slashdotdash Sep 17, 2018
1225cbf
Include Elixir v1.7.2 in Travis CI configuration
slashdotdash Sep 18, 2018
672c126
Disable logger backends for test environments
slashdotdash Sep 18, 2018
47accab
Fix failing tests on Travis CI
slashdotdash Sep 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix failing tests on Travis CI
Due to not waiting for subscriber process to terminate in test.
  • Loading branch information
slashdotdash committed Sep 18, 2018
commit 47accab311c08cd2413247c26b328e8a7e22c04d
21 changes: 10 additions & 11 deletions test/subscriptions/concurrent_subscription_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule EventStore.Subscriptions.ConcurrentSubscriptionTest do
use EventStore.StorageCase

alias EventStore.EventFactory
alias EventStore.{EventFactory, ProcessHelper}
alias EventStore.Subscriptions.Subscription

describe "concurrent subscription" do
Expand Down Expand Up @@ -186,6 +186,7 @@ defmodule EventStore.Subscriptions.ConcurrentSubscriptionTest do
refute_receive {:events, _received_events, _subscriber}
end

@tag :wip
test "should resend in-flight events when subscriber process terminates" do
subscription_name = UUID.uuid4()
stream_uuid = UUID.uuid4()
Expand All @@ -205,10 +206,10 @@ defmodule EventStore.Subscriptions.ConcurrentSubscriptionTest do
assert_receive_events([2], :subscriber2)
assert_last_ack(subscription, 0)

Process.unlink(subscriber1)
Process.exit(subscriber1, :shutdown)
ProcessHelper.shutdown(subscriber1)

Subscription.ack(subscription, 2, subscriber2)

assert_receive_events([1], :subscriber2)
assert_last_ack(subscription, 0)

Expand Down Expand Up @@ -243,11 +244,11 @@ defmodule EventStore.Subscriptions.ConcurrentSubscriptionTest do
assert_receive_events([1, 3], :subscriber1)
assert_receive_events([2], :subscriber2)

Process.unlink(subscriber1)
Process.exit(subscriber1, :shutdown)
assert_last_ack(subscription, 0)
ProcessHelper.shutdown(subscriber1)

assert_last_ack(subscription, 0)
assert_receive_events([1], :subscriber2)

Subscription.ack(subscription, 2, subscriber2)
assert_last_ack(subscription, 0)

Expand Down Expand Up @@ -276,13 +277,11 @@ defmodule EventStore.Subscriptions.ConcurrentSubscriptionTest do
assert_receive_events([1], :subscriber1)
assert_receive_events([2], :subscriber2)

Process.unlink(subscriber1)
Process.unlink(subscriber2)
ref = Process.monitor(subscription)

Process.exit(subscriber1, :shutdown)
Process.exit(subscriber2, :shutdown)
ProcessHelper.shutdown(subscriber1)
ProcessHelper.shutdown(subscriber2)

ref = Process.monitor(subscription)
assert_receive {:DOWN, ^ref, _, _, _}
end

Expand Down