Medusa is a Pub/Sub system that leverages GenStage.
You should declare routes in String
like
the following examples:
Medusa.consume "foo.bar", &Honey.doo/1 # Matches only "foo.bar" events.
Medusa.consume "foo.*" &Lmbd.bo/1 # Matches all "foo. ..." events
Then, to publish something, you call:
Medusa.publish "foo.bar", my_awesome_payload
It can only consume functions of arity 1.
If available in Hex, the package can be installed as:
- Add
medusa
to your list of dependencies inmix.exs
:
```elixir
def deps do
[{:medusa, "~> 0.1.0"}]
end
```
- Ensure
medusa
is started before your application:
```elixir
def application do
[applications: [:medusa]]
end
```
Run tests with the included test script. Arguments pasted to this script will be forwarded to mix test. This allows the test runner to execute single tests.
./run_test.sh
./run_test.sh test/my_test:10