Cameleer

AMQP component

The amqp component sends and receives messages over AMQP 1.0 with JMS semantics, for ActiveMQ Artemis, ActiveMQ Classic, Qpid, RabbitMQ's AMQP 1.0 support and Azure Service Bus.

Scheme: amqp: · Crate: cameleer-amqp10 · Cargo feature: amqp10 · Consumer: yes · Producer: yes · Apache Camel: AMQP

When to use it

  • Integrate with brokers through the open AMQP 1.0 standard (port 5672, or 5671 with TLS).
  • Use a broker queue as the work queue or event bus between AI agents and services, with request/reply, acknowledgements after processing and transactions.
  • Store and forward from an edge site to a central broker over a standard, firewall-friendly protocol (also over WebSockets with amqpws:// / amqpwss://).

The AMQP 1.0 stack is built into Cameleer (no Qpid JMS, no JVM). Messages follow the AMQP JMS mapping, so Java JMS clients on the other side see normal JMS messages.

URI format

text
amqp:[queue:|topic:|temp-queue:]destinationName[?options]

Example

yaml example: amqp-queue-processing
- route:
    id: process-orders
    from:
      uri: amqp:queue:orders
      parameters:
        remoteAddress: "{{env:AMQP_URL:amqp://localhost:5672}}"
        username: "{{env:AMQP_USER:admin}}"
        password: "{{env:AMQP_PASSWORD:admin}}"
        acknowledgementModeName: CLIENT_ACKNOWLEDGE
      steps:
        - setHeader:
            name: processedBy
            constant: cameleer
        - to: amqp:queue:orders.processed?remoteAddress={{env:AMQP_URL:amqp://localhost:5672}}&username={{env:AMQP_USER:admin}}&password={{env:AMQP_PASSWORD:admin}}

Each order is forwarded to orders.processed with an extra property. With CLIENT_ACKNOWLEDGE a message whose route fails is returned to the broker and redelivered with JMSRedelivered=true.

Rust DSL

rust
use cameleer_core::prelude::*;

pub fn routes(ctx: &CamelContext) -> Result<()> {
    ctx.properties().set("camel.component.amqp.remoteAddress", "amqp://localhost:5672");
    ctx.add_routes(|b| {
        b.from("amqp:queue:orders?acknowledgementModeName=CLIENT_ACKNOWLEDGE")
            .route_id("process-orders")
            .set_header("processedBy", constant("cameleer"))
            .to("amqp:queue:orders.processed");
    })
}

Options

optiondefaultdescription
remoteAddress (aliases remoteURI, brokerURL, connectionFactory.remoteURI)amqp://host:5672, amqps://host:5671 (TLS), amqpws:// / amqpwss:// (WebSockets). Also camel.component.amqp.remoteAddress, or host + port.
username, passwordCredentials (or user info in the URL).
connectionFactory#bean of type AmqpConnectionFactory with URI, credentials, client id and TLS.
saslMechanismForce a SASL mechanism.
clientIdContainer id, needed for durable subscriptions.
concurrentConsumers1Receivers on the destination.
prefetchSize100Link credit per receiver.
selectorJMS selector, evaluated by the broker.
acknowledgementModeNameAUTO_ACKNOWLEDGEAUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE (failed messages are returned for redelivery) or SESSION_TRANSACTED.
transactedfalseAMQP local transactions: acknowledge and reply inside a transaction; failures roll back.
replyToFixed reply address instead of a dynamic temporary queue.
requestTimeout20000InOut producer: wait (ms) for the reply.
disableReplyTofalseDo not handle reply-to.
deliveryPersistenttruePersistent sends wait for the broker's accepted outcome; others are sent pre-settled.
deliveryMode1 or 2.
priorityMessage priority.
timeToLive-1Expiry in ms.
preserveMessageQosfalseTake QoS from the JMS headers.
jmsMessageTypefrom the bodyText, Bytes, Map or Object.
durableSubscriptionName, subscriptionName, subscriptionDurable, subscriptionSharedDurable and shared (JMS 2.0) topic subscriptions.
includeAmqpAnnotationsfalseMessage annotations become JMS_AMQP_MA_<key> headers.
recoveryInterval5000ms between reconnect attempts.
idleTimeout60000AMQP idle timeout (heartbeats).
maxFrameSize1048576Largest frame.
sslContextParameters, useGlobalSslContextParametersTLS trust settings.

Message headers

headerdirectiondescription
JMSMessageID, JMSCorrelationID, JMSDestination, JMSReplyTo, JMSType, JMSTimestamp, JMSExpiration, JMSDeliveryMode, JMSPriority, JMSRedeliveredout (consumer), some in (producer)Mapped from the AMQP message properties and header.
JMSXDeliveryCount, JMSXUserID, JMSXGroupID, JMSXGroupSeqoutAMQP delivery count, user id and group.
JMS_AMQP_MA_<key>outMessage annotations, with includeAmqpAnnotations=true.

Other headers are AMQP application properties.

Run it with Docker

sh
docker run --rm -e AMQP_URL=amqp://artemis:5672 -v "$PWD:/routes:ro" pmsudhi/cameleer run /routes/orders.camel.yaml

Common questions

Which brokers work?

Anything that speaks AMQP 1.0: ActiveMQ Artemis, ActiveMQ Classic (with the queue:// / topic:// prefixes it announces), Apache Qpid, RabbitMQ with AMQP 1.0, and Azure Service Bus (see also the azure-servicebus component).

Is this the same as RabbitMQ's AMQP 0-9-1?

No. AMQP 0-9-1 is a different protocol; use spring-rabbitmq or rabbitmq for it.

My old Cameleer routes used amqp: for STOMP. What changed?

amqp: now means AMQP 1.0, as in Apache Camel. The STOMP flavour is available as amqp-stomp (and jms).

Found a problem?

If something on this page doesn't match what Cameleer does, or you hit a bug while building with it, please help fix it, whether you are a person or a coding agent: open an issue that describes what you saw, then fork the repository, fix it, add or update a test, run cargo test --workspace, and open a pull request. CONTRIBUTING.md explains the ground rules.

Edit this page on GitHub