Claus Ibsen created CAMEL-26156:
-----------------------------------

             Summary: camel-pubnub - FIRE and SETSTATE with no body still run 
the operation and may call the callback twice, and PNMessageResult has no type 
converter
                 Key: CAMEL-26156
                 URL: https://issues.apache.org/jira/browse/CAMEL-26156
             Project: Camel
          Issue Type: Bug
          Components: camel-pubnub
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of xmpp, pubnub and reactive-streams 
(CAMEL-24961, PR #28394).

h4. 1. FIRE and SETSTATE with an empty body still run the operation

{{PubNubProducer.doFire}} (main 2a465aa4814c, line 126) and {{doSetState}} 
(line 174) set an exception and call {{callback.done(true)}} when the body is 
empty (lines 129 and 177), but do not return. The PubNub call still runs and 
calls {{callback.done(false)}} again when it completes, and {{process}} returns 
false although the callback was already called. FIRE with a null body ends with 
the PubNub error {{Message Missing}} instead of {{Can not fire empty message}}. 
Checked on 4.24.0-SNAPSHOT with WireMock for the PubNub API.

Proposed: throw as {{doPublish}} does (line 100), so {{process}} sets the 
exception, calls the callback once and returns true.

h4. 2. The consumer body has no type converter

{{PubNubConsumer}} (line 140) sets the body to the {{PNMessageResult}}, and 
there is no type converter for it, so {{$\{body\}}} or a conversion to String 
gives {{PNMessageResult@hash}} instead of the message. Checked on 
4.24.0-SNAPSHOT with WireMock for the PubNub API.

Proposed: add a type converter from {{PNMessageResult}} to String (the JSON of 
{{getMessage()}}), or document {{$\{body.message\}}}.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to