Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring boot 2.6.7 camel ActiveMQByteMessage exchange body is empty byte array #1345

Open
kesavants opened this issue Sep 2, 2022 · 3 comments
Labels

Comments

@kesavants
Copy link

Describe the Bug

When a active mq consumer is implemented with below gradle dependencies byte message message consumer gets empty byte array
byte[] data = exchange.getIn().getBody(byte[].class); //data is 0 len byte array

spring.sleuth.messaging.enabled:true
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth:2.6.7'
implementation group: 'org.apache.camel.springboot', name: 'camel-jms-starter', version: "3.14.3"
implementation group: 'org.apache.camel.springboot', name: 'camel-activemq-starter', version: "3.14.3"

Issue is tracer calls setObjectProperty which sets the content to null which is never reset

public void setObjectProperty(String name, Object value) throws JMSException {
    checkReadOnlyProperties();
    initializeWritingNoCheck();
    super.setObjectProperty(name, value);
}

private void restoreOldContent() throws JMSException {
if (this.content != null && this.content.length > 0) {
    try {
        ByteSequence toRestore = this.content;
        if (isCompressed()) {
            toRestore = new ByteSequence(decompress(this.content));
            compressed = false;
        }

        this.dataOut.write(toRestore.getData(), toRestore.getOffset(), toRestore.getLength());
        // Free up the buffer from the old content, will be re-written when
        // the message is sent again and storeContent() is called.
        this.content = null;
    } catch (IOException ioe) {
        throw JMSExceptionSupport.create(ioe);
    }
}

Expected Behaviour

Expect the exchange.getIn().getBody(byte[].class) to return the byte array of the message

@kesavants kesavants added the bug label Sep 2, 2022
@jcchavezs
Copy link
Contributor

jcchavezs commented Sep 3, 2022 via email

@kesavants
Copy link
Author

kesavants commented Sep 8, 2022

Are you up for a PR fixing this?

sorry not at the moment

@raduarsenii
Copy link

this is similar with #1310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants