Hivent
Emitting events
Hivent.emit("some:event", %{foo: "bar"}, %{version: 1})Consuming events
defmodule TestConsumer do
@topic "some:event"
@name "test_consumer"
@partition_count 2
use Hivent.Consumer
def process(%Hivent.Event{} = event) do
if do_something(event) do
:ok
else
# Puts the event in the dead letter queue
{:error, "failed to process"}
end
end
endInstallation
If available in Hex, the package can be installed as:
-
Add
hiventto your list of dependencies inmix.exs:
```elixir
def deps do
[{:hivent, "~> 0.1.0"}]
end
```-
Ensure
hiventis started before your application:
```elixir
def application do
[applications: [:hivent]]
end
```