Ack the message
Ack the message
Examples:
ack()
ack(Future {
//Some work
})
Note that in the case of acking with a Future, if the Future fails, then the message is counted as erroneous, and the RecoveryStrategy is use is applied.
Extract the message body.
Extract the message body. Uses a RabbitUnmarshaller to deserialize.
Example:
body(as[JobDescription])
Declarative which declares a channel
Declarative which declares a consumer
Directive which yields the exchange through which the message was published
Extract any arbitrary value from the delivery / Java RabbitMQ objects.
Extract any arbitrary value from the delivery / Java RabbitMQ objects. Accepts a function which receives a Delivery and returns some value.
Like extract, but the provided function should return an Either, with left for a rejection, right for success.
Fail the given element
Directive which yields whether this message been delivered once before (although, not necessarily received)
Nack the message; does NOT trigger the RecoveryStrategy in use.
Given a property, yields Some(value).
Given a property, yields Some(value). If the underlying value does not exist (is null), then it yields None.
Passive topic binding
Passive queue binding
Given a property, yields it's value.
Given a property, yields it's value. If the underlying value does not exist (is null), then it nacks.
Provides values for the consume directive.
Directive which yields the routingKey (topic) through which the message was published
Directives power the declarative DSL of op-rabbit.
In order to define a consumer, you need a channel directive, a consumer directive, and one or more extractor directives. For example:
As seen, directives are composable via
&
. In the end, the directive is applied with a function whose parameters match the output values from the directive(s).One value of the directives, as opposed to accessing the AMQP properties directly, is that they are type safe, and care was taken to reduce the probability of surprise. Death is swiftly issued to
null
andObject
. Some directives, such as property, will nack the message if the value specified can't be extracted; IE it is null. If you'd prefer to use a default value instead of nacking the message, you can specify alternative values using| provide(...)
.Note: the directives themselves don't actually do anything, except when applied / returned. IE: