> For the complete documentation index, see [llms.txt](https://host2host.onibonje.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://host2host.onibonje.com/docs/28-mq-jms-adapter.md).

# MQ and JMS Adapter Architecture

## 1. Overview

**Module:** `h2h-mq-adapter`

Supports **IBM MQ**, **ActiveMQ**, and **Kafka** behind unified messaging SPI. RFP §3.1 requires file, API, **and message-based** integration.

***

## 2. Dual Messaging Strategy

| Technology       | Role                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------------------ |
| **Kafka**        | Internal event backbone (primary); delayed job scheduling via `h2h.jobs.schedule` / `h2h.jobs.execute` |
| **RabbitMQ**     | Delayed job scheduling via `x-delayed-message` exchange (preferred for precise delays)                 |
| **IBM MQ / JMS** | Partner-facing legacy queues, bank enterprise bus                                                      |

```mermaid
flowchart LR
  PartnerMQ[Partner IBM MQ]
  Adapter[h2h-mq-adapter]
  Camel[Camel Routes]
  Kafka[Kafka internal]

  PartnerMQ <--> Adapter
  Adapter <--> Camel
  Camel --> Kafka
```

***

## 3. MqAdapter SPI

```java
public interface MqMessageProducer {
    void send(String destination, H2hMessage message, H2hContext context);
}
public interface MqMessageConsumer {
    void onMessage(H2hMessage message, H2hContext context);
}
```

| Backend  | Camel component                      |
| -------- | ------------------------------------ |
| Kafka    | `kafka:`                             |
| IBM MQ   | `jms:queue:` (MQ connection factory) |
| ActiveMQ | `jms:queue:`                         |

***

## 4. Partner MQ Configuration

`channel_config` JSON:

```json
{
  "channelType": "MQ",
  "queueManager": "QM1",
  "inboundQueue": "PARTNER.ACME.IN",
  "outboundQueue": "PARTNER.ACME.OUT",
  "connectionRef": "vault:secret/mq/acme/connection"
}
```

***

## 5. Message Envelope

Same as [H2hEvent envelope](/docs/21-event-driven-runtime-extensibility.md) — `correlationId`, payload, headers for bridge to canonical processing.

***

## 6. Bridge Pattern

Inbound MQ message → Camel `direct:execute-profile` (same pipeline as SFTP/API).

Outbound ACK → MQ reply queue or partner outbound queue.

***

## 7. HA

| MQ     | Approach                     |
| ------ | ---------------------------- |
| IBM MQ | Cluster QM, client reconnect |
| Kafka  | Strimzi 3 brokers            |

***

## 8. Related Documents

* [21 Event-Driven Runtime Extensibility](/docs/21-event-driven-runtime-extensibility.md)
* [08 Camel Integration Patterns](/docs/08-camel-integration-patterns.md)
* [02 Technology Stack](/docs/02-technology-stack.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://host2host.onibonje.com/docs/28-mq-jms-adapter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
