[ 
https://issues.apache.org/jira/browse/CAMEL-26156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136594#comment-18136594
 ] 

Claus Ibsen commented on CAMEL-26156:
-------------------------------------

PR: https://github.com/apache/camel/pull/28928

* FIRE and SETSTATE now throw the CamelException on an empty body, as PUBLISH 
does: the callback is called once, process returns true, and PubNub is not 
called.
* A new PubNubConverter converts PNMessageResult to String: a string message as 
its text, any other message as JSON.

Tests fail before and pass after. Upgrade guide entry added.

_Claude Code on behalf of Claus Ibsen (davsclaus)_

> 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
>            Assignee: Claus Ibsen
>            Priority: Minor
>             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