gnodet commented on code in PR #28394:
URL: https://github.com/apache/camel/pull/28394#discussion_r4367118843
##########
components/camel-rocketmq/src/main/java/org/apache/camel/component/rocketmq/RocketMQEndpoint.java:
##########
@@ -36,6 +39,17 @@
*/
@UriEndpoint(firstVersion = "3.20.0", scheme = "rocketmq", syntax =
"rocketmq:topicName", title = "RocketMQ",
category = Category.MESSAGING, headersClass =
RocketMQConstants.class)
+@BodyTypes(consumerOut = @BodyType(value = Carrier.BYTES, javaType = "byte[]",
+ description = "The body of the RocketMQ
message. The consumer does not reply: the body"
+ + " the route ends with is
not sent back"),
+ producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES,
Carrier.STREAM, Carrier.FILE },
+ description = "What converts to a byte
array: text, bytes, a stream or a file, sent as"
+ + " the body of the message. A
Map, a POJO, a number or no body fails, and"
+ + " the broker rejects an
empty body: marshal it first"),
+ producerOut = @BodyType(value = Carrier.UNCHANGED, dependsOn =
"replyToTopic",
+ description = "The body is left as it was.
With the InOut pattern and a replyToTopic,"
+ + " the producer waits for
the reply and the body is the reply as a byte"
Review Comment:
<!-- gnodet-bot -->
The byte-array reply type is documented in prose but not machine-readable.
When `replyToTopic` is set, `dependsOn` marks the default carrier as "not
known" (per `@BodyType` Javadoc) unless `byOption` fills it in. Consider adding:
```java
byOption = @BodyType.When(option = "replyToTopic", value = "*",
carriers = Carrier.BYTES,
javaType = "byte[]")
```
(or dropping `dependsOn` and describing the conditional semantics in prose
only — also valid given `replyToTopic` is a freeform string).
##########
components/camel-pubnub/src/main/java/org/apache/camel/component/pubnub/PubNubEndpoint.java:
##########
@@ -34,6 +37,41 @@
*/
@UriEndpoint(firstVersion = "2.19.0", scheme = "pubnub", title = "PubNub",
syntax = "pubnub:channel",
category = { Category.CLOUD, Category.IOT, Category.MESSAGING },
headersClass = PubNubConstants.class)
+@BodyTypes(consumerOut = @BodyType(value = Carrier.POJO,
+ javaType =
"com.pubnub.api.models.consumer.pubsub.PNMessageResult",
+ byOption = @BodyType.When(option =
"withPresence", value = "true",
+ carriers =
Carrier.POJO),
Review Comment:
<!-- gnodet-bot -->
The `byOption` for `withPresence=true` is missing `javaType`. The
description text names the type (`PNPresenceEventResult`), and all sibling
`byOption` entries in `producerOut` include `javaType`. Suggest:
```java
byOption = @BodyType.When(option = "withPresence", value = "true",
carriers = Carrier.POJO,
javaType =
"com.pubnub.api.models.consumer.presence.PNPresenceEventResult"),
```
--
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]