After following the documentation and setting up successfully the eventstore, here what happens if i disconnect from internet for about 2-3 minutes
note: this happens on osx with the mentioned at the end deps.
first it shuts down its own DB, then the main DB and finally it terminates the whole app..
defmodule App.EventStore.Subscriber do
use GenServer
alias App.EventStore.EventStore
alias App.Accounts
def start_link(_args) do
GenServer.start_link(__MODULE__, [])
end
def received_events(subscriber) do
GenServer.call(subscriber, :received_events)
end
def init(events) do
# Subscribe to events from all streams
{:ok, subscription} =
EventStore.subscribe_to_all_streams("topic_subscription", self())
{:ok, %{events: events, subscription: subscription}}
end
# Successfully subscribed to all streams
def handle_info({:subscribed, subscription}, %{subscription: subscription} = state) do
{:noreply, state}
end
# Event notification
def handle_info({:events, events}, state) do
%{events: existing_events, subscription: subscription} = state
...........
[debug] Subscription "topic_subscription"@"$all" subscriber #PID<0.818.0> down due to: :shutdown
[debug] Subscription "topic_subscription"@"$all" has no subscribers, shutting down
[debug] Monitored server Postgrex.Notifications terminate due to: :shutdown
[debug] Monitored server Postgrex terminate due to: :shutdown
[debug] Monitored server Postgrex terminate due to: :shutdown
After following the documentation and setting up successfully the eventstore, here what happens if i disconnect from internet for about 2-3 minutes note: this happens on osx with the mentioned at the end deps.
first it shuts down its own DB, then the main DB and finally it terminates the whole app..
[debug] Subscription "topic_subscription"@"$all" subscriber #PID<0.818.0> down due to: :shutdown [debug] Subscription "topic_subscription"@"$all" has no subscribers, shutting down [debug] Monitored server Postgrex.Notifications terminate due to: :shutdown [debug] Monitored server Postgrex terminate due to: :shutdown [debug] Monitored server Postgrex terminate due to: :shutdown