You use the AMQP 0.9.1 binding to connect Ditto with message brokers like RabbitMQ for consuming and publishing messages.
connectionType: "amqp-091". Source addresses are queue names, and target addresses use the format exchange_name/routing_key.Overview
The AMQP 0.9.1 protocol binding lets you consume messages from AMQP 0.9.1 brokers via sources and publish messages via targets.
When you send messages in Ditto Protocol format (UTF-8 encoded strings),
set the content-type to:
application/vnd.eclipse.ditto+json
For other payload formats, configure a payload mapping.
AMQP 0.9.1 properties
Ditto interprets these AMQP 0.9.1 properties:
content-type– defines the Ditto Protocol content typecorrelation-id– correlates request messages to responses
Connection URI format
amqp://user:password@hostname:5672/vhost
Use amqps:// for TLS-secured connections.
Source configuration
The common source configuration applies. Source addresses are
AMQP 0.9.1 queue names:
{
"addresses": ["queueName"],
"authorizationContext": ["ditto:inbound-auth-subject"]
}
Source acknowledgement handling
When you configure acknowledgement requests:
- Successful acknowledgements – Ditto sends an
Ackfor the receiveddeliveryTag - Failed with redelivery needed – Ditto sends a
Nackwithrequeue: true - Failed without redelivery – Ditto sends a
Nackwithrequeue: false
Target configuration
The common target configuration applies. The target address
combines the exchange name and routing key:
{
"address": "exchangeName/routingKey",
"topics": [
"_/_/things/twin/events",
"_/_/things/live/messages"
],
"authorizationContext": ["ditto:outbound-auth-subject"]
}
The target address supports placeholders.
Target acknowledgement handling
When you configure issued acknowledgement labels:
| Status | Condition |
|---|---|
200 |
Message successfully ACKed by the broker |
400 |
Broker does not support publisher confirms |
503 |
Broker negatively confirmed the message |
Specific configuration options
There are no AMQP 0.9.1-specific configuration properties.
Example connection JSON
{
"id": "rabbit-example-connection-123",
"connectionType": "amqp-091",
"connectionStatus": "open",
"failoverEnabled": true,
"uri": "amqp://user:password@localhost:5672/vhost",
"sources": [{
"addresses": ["queueName"],
"authorizationContext": ["ditto:inbound-auth-subject"]
}],
"targets": [{
"address": "exchangeName/routingKey",
"topics": [
"_/_/things/twin/events",
"_/_/things/live/messages"
],
"authorizationContext": ["ditto:outbound-auth-subject"]
}]
}
Further reading
- Connections overview – connection model and configuration
- Payload mapping – transform message payloads
- Header mapping – map external headers
- TLS certificates – secure connections with TLS