davsclaus opened a new pull request, #3156:
URL: https://github.com/apache/camel-kamelets/pull/3156
_Claude Code on behalf of Claus Ibsen_
Template fixes for bugs found while documenting the messaging Kamelets
(#3153). Each was reproduced first, then fixed and verified on Camel 4.23.0 and
4.24.0-SNAPSHOT against Artemis, IBM MQ, RabbitMQ, NATS and Mosquitto in Docker.
## 1. Messaging sinks waited for a reply
Affected: `jms-apache-artemis-sink`, `jms-pooled-apache-artemis-sink`,
`jms-amqp-10-sink`, `jms-ibm-mq-sink`, `spring-rabbitmq-sink` and `nats-sink`.
A message that expects a reply, for example from `webhook-source`, was sent
as a request and reply. Behind `webhook-source`, with no receiver answering:
| Sink | Before | After |
|---|---|---|
| The three Artemis/AMQP JMS sinks | HTTP 500 after 20 s,
`ExchangeTimedOutException` | HTTP 200 in under 0.25 s |
| `jms-ibm-mq-sink` | HTTP 500 after 21 s; also not allowed to open the
temporary reply queue | HTTP 200 |
| `spring-rabbitmq-sink` | HTTP 500 after 30 s, `AmqpReplyTimeoutException`
| HTTP 200 |
| `nats-sink` | HTTP 500 at once, no responders | HTTP 200 |
The fix is `pattern: InOnly` on the send step. Camel switches the pattern
only for that send, so the caller keeps its own message, unchanged, and its own
pattern.
Verified with a receiver too: messages arrive with no `JMSReplyTo`,
`JMSCorrelationID` or NATS reply subject. No earlier commit chose request and
reply on purpose. `spring-rabbitmq-sink`'s publisher confirms (`confirm`,
`confirmTimeout`) work only for InOnly sends, so they now apply to every
message.
## 2. `nats-source` forced `Content-Type: application/json`
The first version (8f1c10c99) added `marshal: json`. That step suits sources
that emit Java objects, but NATS delivers bytes, so the step only left the
payload as it was and forced `Content-Type: application/json`. It even
overwrote a sender's `Content-Type: text/plain`.
The step is removed. The body is now the payload as bytes, checked with
non-UTF-8 bytes, and the sender's `Content-Type` comes through. The now unused
`camel:jackson` dependency and `types.out` media type are left for a later
clean-up, since the dependency is part of the SBOM.
## 3. `mqtt-source` and `mqtt5-source` shared a default client ID
Both defaulted `clientId` to `mqtt-source`. Two integrations on one broker
kept disconnecting each other:
- each received only 4 to 8 of 10 messages;
- the broker logged about 23 "already connected" lines.
The default is removed, and the template uses `{{?clientId}}`, so the
component generates a client ID per connection, as the MQTT sinks already did.
After the fix, both pairings (mqtt+mqtt and mqtt+mqtt5) receive 10 of 10, with
no disconnects. An explicit `clientId` works as before.
## Behaviour changes on upgrade
- **The six sinks no longer do request and reply.** A caller that relied on
getting the answer of a receiver as its body now gets its own message back.
- **`nats-source`:**
- the body is `byte[]` instead of a stream;
- `Content-Type` is no longer forced to `application/json`.
- **`mqtt-source` and `mqtt5-source` without a `clientId`:** the broker sees
a generated ID instead of `mqtt-source`. This matters only for broker ACLs or
monitoring keyed on that ID.
The descriptions in #3153 describe the old behaviour of these points. I will
update them after this is merged, or in #3153, whichever merges second.
`./mvnw clean install` from the root passes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]