Claus Ibsen created CAMEL-26259:
-----------------------------------

             Summary: camel-alibaba-mns - a byte[], stream or File body is sent 
as a String, which corrupts binary data, and the receiveMessage operation does 
not work
                 Key: CAMEL-26259
                 URL: https://issues.apache.org/jira/browse/CAMEL-26259
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of alibaba-mns (CAMEL-24961, PR 
#28409).

h4. 1. Binary bodies are corrupted

{{MNSUtils.resolveMessageBody}} (main 2a465aa4814c, line 121) converts any 
non-String body to String, so binary byte[], stream and File bodies are changed 
before {{setMessageBody(String)}} ({{MNSProducer}}, lines 62 and 96), though 
the SDK has {{setMessageBody(byte[])}}. Checked on 4.24.0-SNAPSHOT with a 
Mockito client set on the endpoint.

Proposed: send byte[] (and stream/File converted to byte[]) with 
{{setMessageBody(byte[])}}.

h4. 2. receiveMessage is offered but does not work

{{receiveMessage}} is in the operation enums and the docs ({{MNSEndpoint}}, 
line 46; {{MNSOperations}}, line 22), but the producer throws 
{{UnsupportedOperationException}} for it ({{MNSProducer}}, line 55) and the 
consumer ignores the operation. Checked on 4.24.0-SNAPSHOT with a Mockito 
client set on the endpoint.

Proposed: remove receiveMessage from the producer enums and docs (the consumer 
receives), or implement it.

h4. 3. The message id and MD5 are documented as headers but set as exchange 
properties

{{MNSHeaders.MESSAGE_ID}} and {{MESSAGE_BODY_MD5}} are labelled {{common}} 
headers, and the consumer sets them as headers ({{MNSConsumer}}, lines 
102-104), but the producer sets them as exchange properties ({{MNSProducer}}, 
lines 112 and 118). Checked on 4.24.0-SNAPSHOT with a Mockito client set on the 
endpoint.

Proposed: set them as headers on the producer as well (or document them as 
properties for the producer).

_Claude Code on behalf of davsclaus_



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

Reply via email to