# Configure connection properties from the connector to a JMS message broker

The `jms` section configures the properties of connections to the JMS message broker.

By default, the connector supports the following JMS message brokers:

-   IBM MQ
-   Solace
-   ActiveMQ Artemis
-   RabbitMQ

See the [Examples](#examples) section for examples of the `jms` section of each of these message brokers.

## Procedure

-   [Specify the properties of the JMS message broker that you are using.](#specify-message-broker-properties)
-   [Specify the authorization credentials that you want to use for connections to the JMS message broker.](#specify-authorization-credentials)

## Specify message broker properties

Use the following options to set the values of the properties that the connector must use when connecting to the JMS message broker:

| Option | Required | Default | Description |
| --- | --- | --- | --- |
| `factory` | yes |  | Name of the connection factory. Will be specific to the message broker being used. |
| `jndi-cf-name` | no |  | Name of the JNDI factory configured at the message broker. |
| `spec` | no | `1.0` | JMS specification the message broker supports. |
| `config` | no |  | Lists the configuration parameters to be passed to the connection factory. The parameters that you must use depend on which JMS message broker you want to connect to. |
| `import-config-file` | no |  | File from which to import additional configuration parameters. Use for sensitive configuration parameters, such as security credentials. These parameters are merged with those in the `config` section. |
| `max-connections` | no | `1` | Maximum number of JMS connections to establish to the JMS message broker. |
| `max-sessions-per-connection` | no | `1` | Maximum number of JMS sessions to open per JMS connection. |

Here is an example of using the `import-config-file` property. Suppose that your `jms` section for making a connection to RabbitMQ looks like this:

```yaml
jms:

  factory: com.rabbitmq.jms.admin.RMQConnectionFactory

  config:

    host: 10.0.2.34

    port: 5672

  import-config-file: credentials.yml
```

You use the property `import-config-file` and point to the file `credentials.yml`, which contains this content:

-   The imported credentials file

credentials.yml

```yaml
username: guest

password: guest
```

At runtime, the content of `credentials.yml` is merged into the `config` section:

```yaml
jms:

  factory: com.rabbitmq.jms.admin.RMQConnectionFactory

  config:

    host: 10.0.2.34

    port: 5672

    username: guest

    password: guest
```

## Specify authorization credentials

The configuration parameters that you use to specify the authentication information that the JMS connector uses to connect to JMS message brokers differ according to the message broker.

### Authenticating to IBM MQ

Use the `credentials` section to provider a username and path to a file that contains the corresponding password.

| Property | Required | Description |
| --- | --- | --- |
| `username` | yes | Username to use for connecting |
| `password-file` | yes | File containing the password. Everything after the first newline is ignored. Trailing spaces in the first line are not ignored. |

### Authenticating to Solace or Active MQ Artemis

In the `config` section, you must provide values for two properties required for authenticating to LDAP by using the Java Naming and Directory Interface (JNDI).

| Property | Required | Description |
| --- | --- | --- |
| `java.naming.security.principal` | yes | Specifies the name of the user/program doing the authentication and depends on the value of the Context.SECURITY\_AUTHENTICATION property that you have set in Solace or Active MQ Artemis. |
| `java.naming.security.credentials` | yes | Specifies the credentials of the user/program doing the authentication and depends on the value of the Context.SECURITY\_AUTHENTICATION property that you have set in Solace or Active MQ Artemis. |

### Authenticating to RabbitMQ

In the `config` section, you must provide properties that correspond to the authentication mechanism that you have set up in RabbitMQ. For example, if RabbitMQ is configured for SASL PLAIN authentication, then you must provide values for the properties `username` and `password`.

## Examples

### IBM MQ

```yaml
jms:

  factory: com.ibm.mq.jms.MQConnectionFactory

  spec: 2.0

  config:

    hostName: 10.0.2.5

    port: 1414

    queueManager: QM1

    transportType: 1

    channel: DEV.APP.SVRCONN

  credentials:

    username: admin

    password-file: /path/to/password/file.txt
```

### Solace

```yaml
jms:

  factory: com.solacesystems.jndi.SolJNDIInitialContextFactory

  jndi-cf-name: /JNDI/CF/Aerospike

  config:

    java.naming.provider.url: 10.0.1.54:55555

    java.naming.security.principal: username@jms-inbound-test

    java.naming.security.credentials: password

  import-config-file: credentials.yml
```

### ActiveMQ Artemis

```yaml
jms:

  factory: org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory

  jndi-cf-name: ConnectionFactory

  config:

    java.naming.provider.url: tcp:/10.2.54.1:61616?user=artemis&password=simetraehcapa

    java.naming.security.principal: artemis

    java.naming.security.credentials: simetraehcapa

  max-connections: 32

  max-sessions-per-connection: 8
```

### RabbitMQ

```yaml
jms:

  factory: com.rabbitmq.jms.admin.RMQConnectionFactory

  config:

    host: 10.0.2.34

    port: 5672

    username: guest

    password: guest
```