Examples.EEventBroker.WithSub (event_broker v1.1.1)

Copy Markdown

I contain examples of how the with_subscription block works.

Summary

Functions

__ex_example__with_existing_subscription__(filter \\ %EFilter.AcceptAll{})

I check that, when a process is subscribed to a given filter, that filter still exists after a with_subscription block that uses the same filter.

__ex_example__with_nested_subscription__(list \\ [%{__struct__: Examples.EEventBroker.EFilter.AcceptAll}, %{__struct__: Examples.EEventBroker.EFilter.Error}])

I nest two with_subscription blocks and assert that the middle one is subscribed to the outer topics as well.

__ex_example__with_subscription__(filter \\ %EFilter.AcceptAll{})

I run a piece of code with a subscription. I assert that the messages sent within this block are sent to me.

__ex_example__with_subscriptions__(filters \\ [%{__struct__: Examples.EEventBroker.EFilter.AcceptAll}, %{__struct__: Examples.EEventBroker.EFilter.Error}])

I run a piece of code with a subscription to multiple filters. I assert that the messages sent within this block are sent to me.

copy(item)

Callback implementation for ExExample.Behaviour.copy/1.

rerun?(_)

Callback implementation for ExExample.Behaviour.rerun?/1.

with_existing_subscription(filter \\ %EFilter.AcceptAll{})

@spec with_existing_subscription(struct()) :: struct()

with_nested_subscription(list \\ [%{__struct__: Examples.EEventBroker.EFilter.AcceptAll}, %{__struct__: Examples.EEventBroker.EFilter.Error}])

@spec with_nested_subscription([struct()]) :: [struct()]

with_subscription(filter \\ %EFilter.AcceptAll{})

@spec with_subscription(struct()) :: struct()

with_subscriptions(filters \\ [%{__struct__: Examples.EEventBroker.EFilter.AcceptAll}, %{__struct__: Examples.EEventBroker.EFilter.Error}])

@spec with_subscriptions([struct()]) :: [struct()]