# Nats

Kubemq nats source connector allows services using kubemq server to access nats messaging services.

## Prerequisites

The following are required to run the nats source connector:

* kubemq cluster
* nats server
* kubemq-sources deployment

## Configuration

nats source connector configuration properties:

| Properties Key   | Required | Description                                      | Example          |
| ---------------- | -------- | ------------------------------------------------ | ---------------- |
| url              | yes      | nats connection host                             | "localhost:1883" |
| subject          | yes      | set subject name                                 | any string       |
| dynamic\_mapping | yes      | set if to map nats Destination to kubemq channel | "true"           |
| username         | no       | set nats username                                | "username"       |
| password         | no       | set nats password                                | "password"       |
| token            | no       | set nats token                                   | "my\_token"      |
| tls              | no       | set if tls is needed                             | "false","true"   |
| cert\_file       | no       | tls certificate file in string format            | "my\_file"       |
| cert\_key        | no       | tls certificate key in string format             | "my\_key"        |
| timeout          | no       | connection timeout in seconds                    | "130"            |

Example:

```yaml
bindings:
  - name: nats
    source:
      kind: messaging.nats
      properties:
        cert_file: |-
          -----BEGIN CERTIFICATE-----
          mycert
          -----END CERTIFICATE-----
        cert_key: |-
          -----BEGIN PRIVATE KEY-----
          mykey
          -----END PRIVATE KEY-----
        dynamic_mapping: "false"
        subject: foo
        url: nats://localhost:4222
    target:
      kind: kubemq.events
      properties:
        address: localhost:50000
        channel: event.messaging.nats
        dynamic_mapping: "false"
    properties: {}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kubemq.io/configuration/connectors/kubemq-sources/messaging/nats.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
