davsclaus commented on code in PR #28394:
URL: https://github.com/apache/camel/pull/28394#discussion_r4367550794
##########
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:
With `withPresence=true` the consumer still delivers the messages of the
channel as `PNMessageResult` (`PubNubConsumer` line 141), and the presence
events as `PNPresenceEventResult` (line 163). The body is one or the other, so
it has no single Java type. `javaType` means "always of this type", which is
why it is left out there, and the description names both types.
_Claude Code on behalf of davsclaus_
##########
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:
Keeping `dependsOn` here. The reply body depends on two things:
`replyToTopic`, and the InOut pattern of the exchange. With InOnly and a
`replyToTopic` the body stays unchanged, so a `byOption` saying bytes would be
wrong for those exchanges. `When.value` also takes one value of the option, and
`*` is not a wildcard there. `dependsOn` marks the body as not known from the
options alone, and the description says when it is the reply as a byte array.
_Claude Code on behalf of davsclaus_
--
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]