carotte/publisher
Types
pub opaque type HeaderList
pub type HeaderValue {
BoolHeader(Bool)
FloatHeader(Float)
IntHeader(Int)
StringHeader(String)
ListHeader(List(HeaderValue))
}
Constructors
-
BoolHeader(Bool)
-
FloatHeader(Float)
-
IntHeader(Int)
-
StringHeader(String)
-
ListHeader(List(HeaderValue))
pub type PublishOption {
Mandatory(Bool)
ContentType(String)
ContentEncoding(String)
Headers(HeaderList)
Persistent(Bool)
CorrelationId(String)
Priority(Int)
ReplyTo(String)
Expiration(String)
MessageId(String)
Timestamp(Int)
Type(String)
UserId(String)
AppId(String)
}
Constructors
-
Mandatory(Bool)
If set, returns an error if the broker can’t route the message to a queue
-
ContentType(String)
MIME Content type
-
ContentEncoding(String)
MIME Content encoding
-
Headers(HeaderList)
Headers to attach to the message. Note: headers can currently only be sent, not received.
-
Persistent(Bool)
If set, uses persistent delivery mode. Messages marked as persistent that are delivered to durable queues will be logged to disk
-
CorrelationId(String)
Arbitrary application-specific message identifier
-
Priority(Int)
Message priority, ranging from 0 to 9
-
ReplyTo(String)
Name of the reply queue
-
Expiration(String)
How long the message is valid (in milliseconds)
-
MessageId(String)
Message identifier
-
Timestamp(Int)
timestamp associated with this message (epoch time)
-
Type(String)
Message type
-
UserId(String)
Creating user ID. RabbitMQ will validate this against the active connection user
-
AppId(String)
Application ID
Functions
pub fn headers_from_list(
list: List(#(String, HeaderValue)),
) -> HeaderList
pub fn publish(
channel channel: Channel,
exchange exchange: String,
routing_key routing_key: String,
payload payload: String,
options options: List(PublishOption),
) -> Result(Nil, CarotteError)
Publish a message ‘payload’ to an exchange
The routing_key
is used to filter messages from the exchange
The options
are used to set message properties