AMQP Bridge Extension Swiftlet
Overview
The AMQP Bridge Extension Swiftlet provides bridging capabilities between AMQP 1.0 and AMQP 0.9.1 endpoints. It enables the configuration and management of bidirectional message flows between different AMQP brokers or endpoints, supporting both protocol versions within a single Swiftlet instance.
Features
AMQP 1.0 and 0.9.1 Bridge Management
The Swiftlet allows the creation and management of bridges for both AMQP 1.0 and AMQP 0.9.1 protocols. Each bridge defines a source and a target endpoint, enabling message transfer between two AMQP brokers or endpoints. Bridges can be enabled or disabled dynamically, and their connection status and message transfer statistics are tracked in real time under the usage entity.
For AMQP 1.0 bridges, the bridge uses a configurable Quality of Service (transfer-qos) and supports SASL authentication, SSL, and connection templates for advanced tuning. AMQP 0.9.1 bridges support configuration of exchanges, queues, routing keys, and queue options (durable, exclusive, autodelete), as well as SSL and connect URIs.
Bridge Activation and Scheduling
Bridges can be activated or deactivated via the enabled property. The Swiftlet registers a job with the system scheduler, allowing bridges to be started or stopped programmatically. If a bridge is enabled and the connection fails, it will automatically attempt to reconnect after a configurable retryinterval.
Connection Templates for AMQP 1.0
Reusable connection templates can be defined for AMQP 1.0 endpoints, specifying parameters such as idle timeout, frame size, buffer sizes, session window sizes, and link credit. These templates simplify the configuration of multiple bridges with similar connection requirements.
Usage and Monitoring
The Swiftlet maintains a usage entity that tracks the status of each active bridge, including connection time, last transfer time, and the number of messages transferred. This provides operational visibility into bridge activity and health.
Automatic Message Flow and Delivery Tracking
For AMQP 1.0, the bridge uses a polling mechanism to transfer messages in batches, ensuring efficient throughput. It also tracks unsettled deliveries and ensures proper settlement and acknowledgment. For AMQP 0.9.1, the bridge uses consumer callbacks to transfer messages and acknowledges them upon successful delivery.
Configuration Example:
<swiftlet name="xt$amqpbridge">
<connection-templates>
<connection-template name="fast-conn" idle-timeout="60000" max-frame-size="262144"/>
</connection-templates>
<bridges100>
<bridge100 name="amqp10-bridge" enabled="true" transfer-qos="at-least-once">
<source remote-hostname="broker1" remote-port="5672" sasl-enabled="true" sasl-anonymous-login="false" sasl-loginname="user1" sasl-password="pass1" source-address="queue1" connection-template="fast-conn"/>
<target remote-hostname="broker2" remote-port="5672" sasl-enabled="true" sasl-anonymous-login="false" sasl-loginname="user2" sasl-password="pass2" target-address="queue2" connection-template="fast-conn"/>
</bridge100>
</bridges100>
<bridges091>
<bridge091 name="amqp091-bridge" enabled="true">
<source connect-uri="amqp://user:pass@host1:5672/" exchange-name="ex1" exchange-type="fanout" queue-name="q1" queue-option-durable="true"/>
<target connect-uri="amqp://user:pass@host2:5672/" exchange-name="ex2" routing-key="key2"/>
</bridge091>
</bridges091>
</swiftlet>
Configuration Guide
Bridging Between Two AMQP 1.0 Brokers with Custom Connection Template
Use this scenario when you need to bridge messages between two AMQP 1.0 brokers, applying custom connection parameters for performance or compatibility.
- Define a custom connection template with desired parameters (e.g., frame size, buffer sizes).
- Create a bridge under
bridges100, referencing the custom template for both source and target. - Set authentication and address properties as needed.
- Enable the bridge to start message transfer.
<swiftlet name="xt$amqpbridge">
<connection-templates>
<connection-template name="mytemplate" max-frame-size="262144"/>
</connection-templates>
<bridges100>
<bridge100 name="bridge1" enabled="true">
<source remote-hostname="hostA" remote-port="5672" connection-template="mytemplate"/>
<target remote-hostname="hostB" remote-port="5672" connection-template="mytemplate"/>
</bridge100>
</bridges100>
</swiftlet>
AMQP 0.9.1 Bridge with Durable Queue and Custom Exchange
Use this scenario to bridge messages from a durable queue on one AMQP 0.9.1 broker to an exchange on another broker.
- Create a bridge under
bridges091. - Configure the source with the appropriate connect URI, exchange, queue name, and set
queue-option-durableto true. - Configure the target with the destination connect URI and exchange.
- Enable the bridge to begin transferring messages.
<swiftlet name="xt$amqpbridge">
<bridges091>
<bridge091 name="bridge2" enabled="true">
<source connect-uri="amqp://user:pass@srcbroker:5672/" exchange-name="src-ex" queue-name="src-queue" queue-option-durable="true"/>
<target connect-uri="amqp://user:pass@dstbroker:5672/" exchange-name="dst-ex"/>
</bridge091>
</bridges091>
</swiftlet>
Scheduler Jobs
Bridge
Description: Activates a Bridge
Configuration Reference
The top-level entity in routerconfig.xml is <swiftlet name="xt$amqpbridge">.
<connection-templates> in <swiftlet name="xt$amqpbridge">
Templates for Connections
Each <connection-template> entry is identified by its name attribute (the Connection Template).
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
idle-timeout |
Long | 120000 |
No | No | Idle Timeout (ms) |
max-frame-size |
Long | 131072 |
No | No | Maximum Frame Site (Bytes) |
container-id |
String | — | No | No | Container Id |
open-hostname |
String | — | No | No | Overwrites Hostname set in Open Frame |
input-buffer-size |
Integer | 1048576 |
No | No | Network Input Buffer Size (min: 1024) |
input-buffer-extend-size |
Integer | 1048576 |
No | No | Network Input Buffer Extend Size (min: 1024) |
output-buffer-size |
Integer | 131072 |
No | No | Network Output Buffer Size (min: 1024) |
output-buffer-extend-size |
Integer | 131072 |
No | No | Network Output Buffer Extend Size (min: 1024) |
session-incoming-window-size |
Integer | 100 |
No | No | Session Incoming Window Size (min: 1) |
session-outgoing-window-size |
Integer | 100 |
No | No | Session Outgoing Window Size (min: 1) |
source-link-credit |
Integer | 100 |
No | No | Source Link Credit (min: 1) |
<swiftlet name="xt$amqpbridge">
<connection-templates>
<connection-template name="..."/>
</connection-templates>
</swiftlet>
<bridges100> in <swiftlet name="xt$amqpbridge">
AMQP 1.0 Bridges
Each <bridge100> entry is identified by its name attribute (the AMQP 1.0 Bridge).
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
enabled |
Boolean | false |
No | No | Enables/Disables this Connection |
retryinterval |
Long | 60000 |
No | No | Retry Interval (ms) for Re-Connect |
transfer-qos |
String | exactly-once |
No | No | Transfer Quality of Service (choices: at-most-once, at-least-once, exactly-once) |
<swiftlet name="xt$amqpbridge">
<bridges100>
<bridge100 name="..."/>
</bridges100>
</swiftlet>
<source> in <bridges100>
Source
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
remote-hostname |
String | localhost |
No | No | Remote Host |
remote-port |
Integer | 5672 |
No | No | Remote Port |
use-ssl |
Boolean | false |
No | No | Establishes a SSL Connection |
sasl-enabled |
Boolean | true |
No | No | Enables/Disables SASL Authentication |
sasl-anonymous-login |
Boolean | true |
No | No | Use SASL Anonymous Login |
sasl-loginname |
String | — | No | No | SASL Loginname |
sasl-password |
String | — | No | No | SASL Password |
sasl-mechanism |
String | PLAIN |
No | No | SASL Mechanism |
source-address |
String | sourcequeue |
No | No | Source Address |
source-message-selector |
String | — | No | No | Source Message Selector |
connection-template |
String | default |
No | No | Connection Template |
<target> in <bridges100>
Target
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
remote-hostname |
String | localhost |
No | No | Remote Host |
remote-port |
Integer | 5672 |
No | No | Remote Port |
use-ssl |
Boolean | false |
No | No | Establishes a SSL Connection |
sasl-enabled |
Boolean | true |
No | No | Enables/Disables SASL Authentication |
sasl-anonymous-login |
Boolean | true |
No | No | Use SASL Anonymous Login |
sasl-loginname |
String | — | No | No | SASL Loginname |
sasl-password |
String | — | No | No | SASL Password |
sasl-mechanism |
String | PLAIN |
No | No | SASL Mechanism |
target-address |
String | targetqueue |
No | No | Target Address |
connection-template |
String | default |
No | No | Connection Template |
<bridges091> in <swiftlet name="xt$amqpbridge">
AMQP 0.9.1 Bridges
Each <bridge091> entry is identified by its name attribute (the AMQP 0.9.1 Bridge).
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
enabled |
Boolean | false |
No | No | Enables/Disables this Connection |
retryinterval |
Long | 60000 |
No | No | Retry Interval (ms) for Re-Connect |
<swiftlet name="xt$amqpbridge">
<bridges091>
<bridge091 name="..."/>
</bridges091>
</swiftlet>
<source> in <bridges091>
Source
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
connect-uri |
String | amqp://admin:secret@localhost:5672/ |
No | No | AMQP Connect URI to create the Connection |
use-ssl |
Boolean | false |
No | No | Establishes a SSL Connection |
exchange-name |
String | — | No | No | Exchange Name |
exchange-type |
String | direct |
No | No | Exchange Type |
consumer-tag |
String | — | No | No | Consumer Tag |
queue-name |
String | — | No | No | Queue Name |
queue-option-durable |
Boolean | false |
No | No | Queue is durable? |
queue-option-exclusive |
Boolean | false |
No | No | Queue is exclusive? |
queue-option-autodelete |
Boolean | false |
No | No | Queue is autodelete? |
routing-key |
String | — | No | No | Routing Key |
<target> in <bridges091>
Target
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
connect-uri |
String | amqp://admin:secret@localhost:5672/ |
No | No | AMQP Connect URI to create the Connection |
use-ssl |
Boolean | false |
No | No | Establishes a SSL Connection |
exchange-name |
String | — | No | No | Exchange Name |
routing-key |
String | — | No | No | Routing Key |