---
schema_version: "1"
id: f5208161e10c0c514c89ad24cf918b6c5d2ac29590546b8f7d8c083b180da87b
title: AMQP Connector 1.9
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/amqp-connector/latest/index.md
canonical_url: https://docs.mulesoft.com/amqp-connector/latest/
source_site: docs.mulesoft.com
content_type: documentation
content_hash: bf281fa3a2a0c874062b680bb9afa62a00fc4e6716b85f426c821d8acf13b0a2
description: MuleSoft Documentation Site
release: "1.9"
latest: true
---
---
product: AMQP Connector
version: 1.9
is-latest-version: true
---

# AMQP Connector 1.9

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Anypoint Connector for AMQP (AMQP Connector) enables your application to publish and consume
messages using an AMQP 0.9.1-compliant broker. The connector’s main features include:

- RPC Pattern through request-reply consumption using private temporal queues

- SDK transaction management with optional channel self-recovery

- Synchronous message requesting with timeout

- Management operations for exchange and queue declarations

- All AMQP message properties, including custom headers

- Reply to (publishing replies to the default exchange)

- Automatic, Mule-driven and manual message acknowledgement

- Manual message rejection

- Mandatory and immediate publishing parameters and handling of returned (undelivered) messages
  through error handling

- Prefetch size and count "quality of service" settings

- noLocal and exclusive consumers

- TLS/SSL connectivity

- Message builder functionality similar to that provided by JMS Connector

## Configure the Connector

AMQP Connector comes out of the box with a fine-tuned set of default values for both publishing and
consuming messages. This means that the only requirement is for you to configure which connection to
use.

This example sets a minimal connection to a broker in `localhost`:

```example
<amqp:config name="AMQP_Config">
  <amqp:connection
    host="localhost"
    username="guest"
    password="guest" />
</amqp:config>
```

### Define Global Defaults

You can define a set of default parameters to use while consuming or publishing messages. This way,
you can define a global default behavior for all the operations associated with the configuration
and then override each parameter only in the operations that require a custom behavior.

For example, you can define a prefetch size window in terms of size and in terms of whole messages:

```example
<amqp:config name="AMQP_Config">
   <amqp:connection host="localhost" username="guest" password="guest" />
   <amqp:quality-of-service-config prefetchSize="4" prefetchCount="4" />
   <amqp:consumer-config ackMode="IMMEDIATE" />
   <amqp:publisher-config requestBrokerConfirms="true"/>
</amqp:config>
```

In the previous example, every `consume` operation or listener associated with this configuration
uses an acknowledgement mode of the type `IMMEDIATE`, while for every `publish` or `publish-consume`
operation, the outgoing message requests a confirmation from the broker.

You can override all of these properties at the operation level when required. For example, if you
need to publish a message that does not require confirmation from the broker:

```example
<amqp:publish config-ref="AMQP_Config" requestBrokerConfirms="false"/>
```

## Connect to a Broker

An AMQP connection is defined by a set of general parameters that apply for any connection.

### Provide Credentials For Authentication

To establish an authenticated connection, you have to set the `username`, `password`, and the
`virtualhost` in the `connection` element:

```example
<amqp:config name="AMQP_Config">
  <amqp:connection host="localhost" virtualhost="/" username="guest" password="guest" />
</amqp:config>
```

### Set TLS/SSL Connectivity to the Broker

You can use the parameter `useTls` to create a secure connection to the broker using the default TLS
context. You can also provide a custom TLS context as a child element in the connection, or as
global element in the following way:

```example
<tls:context name="globalTlsContext">
  <tls:trust-store path="tls/tlstest-cacerts.jks"
    password="changeit" />
  <tls:key-store path="tls/tlstest-keystore.jks"
    keyPassword="changeit" password="changeit" />
</tls:context>

<amqp:config name="config">
  <amqp:connection host="localhost" port="5671"
    virtualHost="/" username="guest" password="guest" useTls="true"
    tlsContext="globalTlsContext" />
 </amqp:config>
```

### Server Name Indication

AMQP Connector v1.1.0 and later supports Server Name Indication (SNI). If the broker supports SNI,
it’s available to verify the hostname and present different certificates for the same IP address.

Use the parameter `useSNI` to indicate that the AMQP client should add the hostname as an extension
in the `ClientHello` message during the SSL handshake:

```example
<tls:context name="globalTlsContext">
  <tls:trust-store path="tls/tlstest-cacerts.jks"
    password="changeit" />
  <tls:key-store path="tls/tlstest-keystore.jks"
    keyPassword="changeit" password="changeit" />
</tls:context>

<amqp:config name="config">
  <amqp:connection host="localhost" port="5671"
    virtualHost="/" username="guest" password="guest" useTls="true" useSni="true"
    tlsContext="globalTlsContext" />
 </amqp:config>
```

## See Also

- [Consume Messages](https://docs.mulesoft.com/amqp-connector/latest/amqp-consume)

- [Publish Messages](https://docs.mulesoft.com/amqp-connector/latest/amqp-publish)

- [Listen For New Messages](https://docs.mulesoft.com/amqp-connector/latest/amqp-listener)

- [Listen For A Reply](https://docs.mulesoft.com/amqp-connector/latest/amqp-publish-consume)

- [Message Acknowledgement](https://docs.mulesoft.com/amqp-connector/latest/amqp-ack)

- [Transactions in AMQP](https://docs.mulesoft.com/amqp-connector/latest/amqp-transactions)

- [AMQP Connector Reference](https://docs.mulesoft.com/amqp-connector/latest/amqp-documentation)

- [Salesforce Help](https://help.salesforce.com)
