Conduit v0.2.1 Conduit.Message
The Conduit message.
This module defines a Conduit.Message
struct and the main functions
for working with Conduit messages.
Note this struct is used for sending and receiving messages from a message queue.
Public fields
These fields are for you to use in your application. The values in
meta
, headers
, and status
may have special meaning based on
the adapter you use. See your adapters documention to understand
how to use them correctly.
meta
- Information applicable to every message stored as a map.headers
- Information applicable to a specific message stored as a keyword list.body
- The contents of the message.status
- The operation to perform on the message. This only applies to messages that are being received.
Private fields
These fields are reserved for library/framework usage.
private
- shared library data as a map
Summary
Functions
Assigs the status of the message as acknowledged. This will be used to signal to the message queue that processing the message was successful and can be discarded
Assigns a named value to the message
Retrieves a named value from the message
Returns a header from the message specified by key
Gets a meta property from the message
Retrieves a named value from the message. This is intended for libraries and framework use
Assigs the status of the message to a negative acknowledged. This will be used to signal to the message queue that processing the message was not successful
Assigns the content of the message
Assigns the destination of the message
Assigns a header for the message specified by key
Assigns a meta property to the message
Assigns a meta property to the message if not already set
Assigns a named value to the message. This is intended for libraries and framework use
Assigns the source of the message
Types
Functions
Assigs the status of the message as acknowledged. This will be used to signal to the message queue that processing the message was successful and can be discarded.
Examples
iex> import Conduit.Message
iex> message = ack(%Conduit.Message{})
iex> message.status
:ack
Assigns a named value to the message.
Examples
iex> import Conduit.Message
iex> message = assign(%Conduit.Message{}, :user_id, 1)
iex> assigns(message, :user_id)
1
Retrieves a named value from the message.
Examples
iex> import Conduit.Message
iex> message = assign(%Conduit.Message{}, :user_id, 1)
iex> assigns(message, :user_id)
1
Returns a header from the message specified by key
.
Examples
iex> import Conduit.Message
iex> message = put_header(%Conduit.Message{}, :retries, 1)
iex> get_header(message, :retries)
1
Gets a meta property from the message.
Examples
iex> import Conduit.Message
iex> message = put_meta(%Conduit.Message{}, :content_type, "application/json")
iex> get_meta(message, :content_type)
"application/json"
Retrieves a named value from the message. This is intended for libraries and framework use.
Examples
iex> import Conduit.Message
iex> message = put_private(%Conduit.Message{}, :message_id, 1)
iex> get_private(message, :message_id)
1
Assigs the status of the message to a negative acknowledged. This will be used to signal to the message queue that processing the message was not successful.
Examples
iex> import Conduit.Message
iex> message = nack(%Conduit.Message{})
iex> message.status
:nack
Assigns the content of the message.
Examples
iex> import Conduit.Message
iex> message = put_body(%Conduit.Message{}, "hi")
iex> message.body
"hi"
put_destination(Conduit.Message.t, destination) :: Conduit.Message.t
Assigns the destination of the message.
Examples
iex> import Conduit.Message
iex> message = put_destination(%Conduit.Message{}, "my.queue")
iex> message.destination
"my.queue"
Assigns a header for the message specified by key
.
Examples
iex> import Conduit.Message
iex> message = put_header(%Conduit.Message{}, :retries, 1)
iex> get_header(message, :retries)
1
Assigns a meta property to the message.
Examples
iex> import Conduit.Message
iex> message = put_meta(%Conduit.Message{}, :content_type, "application/json")
iex> get_meta(message, :content_type)
"application/json"
Assigns a meta property to the message if not already set.
Examples
iex> import Conduit.Message
iex> message =
iex> %Conduit.Message{}
iex> |> put_new_meta(:content_type, "application/json")
iex> |> put_new_meta(:content_type, "application/xml")
iex> get_meta(message, :content_type)
"application/json"
Assigns a named value to the message. This is intended for libraries and framework use.
Examples
iex> import Conduit.Message
iex> message = put_private(%Conduit.Message{}, :message_id, 1)
iex> get_private(message, :message_id)
1