Last update: Jan 24, 2022
Since | v0.9 |
---|---|
Namespace | backend/amqp/consumer |
Log prefix | [BACKEND: /foo][AMQP] |
Scope | backend , async_agent |
Source | krakendio/krakend-amqp |
The AMQP component allows to send and receive messages to and from a queue through the API Gateway.
The configuration of the queue is a straightforward process. To connect the endpoints to the messaging system you only need to include the extra_config
key with the namespaces backend/amqp/consumer
or backend/amqp/producer
.
To create Async agents that consume messages asynchronously and without requiring a user request, see Async Agents.
The parameters of this integration follow the AMQP specification. To understand what are the implications of a certain parameter, see the AMQP Complete Reference Guide.
KrakenD creates both the exchange and the queue for you.
The consumer retrieves messages from the queue when a KrakenD endpoint plugs to its AMQP backend. The recommendation is to connect consumers to GET
endpoints.
A single endpoint can consume messages from N queues, or can consume N messages from the same queue by adding N backends with the proper queue name.
See Async Agents to consume messages without an endpoint.
The needed configuration to run a consumer is:
{
"backend": [{
"host": ["amqp://guest:[email protected]:5672"],
"disable_host_sanitize": true,
"extra_config": {
"backend/amqp/consumer": {
"name": "queue-1",
"exchange": "some-exchange",
"durable": true,
"delete": false,
"no_wait": true,
"no_local": false,
"routing_key": ["#"],
"prefetch_count": 10,
"prefetch_size": 1024,
"auto_ack": false
}
}
}]
}
| When KrakenD retrieves the messages, regardless of the success or failure of the operation, it marks them as ACK nowledge.Defaults to false |
| Setting to false is recommended to avoid deletions when the consumer is disconnected.Defaults to false |
| Durable queues will survive server restarts and remain when there are no remaining consumers or bindings. true is recommended, but depends on the use case.Defaults to false |
| The exchange name (must have a topic type if already exists). |
| Queue name. |
| The no_local flag is not supported by RabbitMQ. |
| When true, do not wait for the server to confirm the request and immediately begin deliveries. If it is not possible to consume, a channel exception will be raised and the channel will be closed. |
| The number of messages you want to prefetch prior to consume them. Defaults to 10 |
| The number of bytes you want to use to prefetch messages. Defaults to 1024 |
| The list of routing keys you will use to consume messages. |
* indicates a required field. Parameters in alphabetical order.
The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.
We use cookies to understand how you use our site and to improve your overall experience. By continuing to use our site, you accept our Privacy Policy. More information