itk_queue v0.10.11 ITKQueue View Source
Provides convenience functions for subscribing to queues and publishing messages.
Link to this section Summary
Functions
Declares a queue
Deletes a queue
Publish a message. Expects the message to be something that can be encoded as JSON
Subscribes to a queue
Link to this section Types
Link to this section Functions
Declares a queue.
Deletes a queue.
Publish a message. Expects the message to be something that can be encoded as JSON.
Examples
iex> ITKQueue.publish("data.sync", %{type: "user", data: %{name: "Test User"}})
Subscribes to a queue.
The handler is expected to be a function that handles the message. If the function raises an exception the message will be moved to a temporary queue and retried after a delay.
Examples
iex> ITKQueue.subscribe("students-data-sync", "data.sync", fn(message) -> IO.puts(inspect(message)) end)