View Source Yggdrasil.Adapter (Yggdrasil v6.0.3)
This module defines a generalization of an adapter (for adapter creation
refer to Yggdrasil.Subscriber.Adapter and Yggdrasil.Publisher.Adapter
behaviour).
adapter-alias
Adapter alias
If you already have implemented the publisher and subscriber adapters, then
you can alias the module names in order to publish and subscribe using the
same Channel struct.
Let's say that you have both Yggdrasil.Publisher.Adapter.MyAdapter and
Yggdrasil.Subscriber.Adapter.MyAdapter and you want to alias both of this
modules to :my_adapter, the you would do the following:
defmodule Yggdrasil.Adapter.MyAdapter do
use Yggdrasil.Adapter, name: :my_adapter
endAnd adding the following to your application supervision tree:
Supervisor.start_link([
{Yggdrasil.Adapter.MyAdapter, []}
...
])This will allow you to use :my_adapter as a Channel adapter to subscribe
and publish with MyAdapter e.g:
%Channel{name: "my_channel", adapter: :my_adapter}
Link to this section Summary
Functions
Macro for using Yggdrasil.Adapter.
Checks that the module exists.
Generates module given an adapter module and a type.
Link to this section Types
@type type() :: Subscriber | Publisher
Adapter types.
Link to this section Functions
Macro for using Yggdrasil.Adapter.
The following are the available options:
:name- Name of the adapter. Must be an atom.:transformer- Default transformer module or alias. Defaults to:default:backend- Default backend module or alias. Defaults to:default.:subscriber- Subscriber module. Defaults toYggdrasil.Subscriber.Adapter.<NAME>where<NAME>is the last part of the current module name e.g. the<NAME>forYggdrasil.MyAdapterwould beMyAdapter. If the module does not exist, then defaults to:elixir.:publisher- Publisher module. Defaults toYggdrasil.Publisher.Adapter.<NAME>where<NAME>is the last part of the current module name e.g. the<NAME>forYggdrasil.MyAdapterwould beMyAdapter. If the module does not exist, then defaults to:elixir.
Checks that the module exists.
Generates module given an adapter module and a type.