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

IncomingJmsMessage assumes message type it won't be empty #2625

Closed
neazevedo opened this issue May 20, 2024 · 5 comments · Fixed by #2630
Closed

IncomingJmsMessage assumes message type it won't be empty #2625

neazevedo opened this issue May 20, 2024 · 5 comments · Fixed by #2630
Labels
bug Something isn't working jms

Comments

@neazevedo
Copy link

When used to connect with (legacy activemq server) activemq-client v6.1.1, sending a JMSMessage by default type is "" (empty).

image

image

After consuming a JMSMessage JMSType came empty and we try to load type "" from the classloader.

Can we add extra isNotEmpty() validation?
Thanks

@neazevedo
Copy link
Author

Possible solution:

 IncomingJmsMessage(Message message, Executor executor, JsonMapping jsonMapping) {
        this.delegate = message;
        this.jsonMapping = jsonMapping;
        this.executor = executor;
        String cn = null;
        try {
            cn = message.getStringProperty("_classname");
            if (cn == null) {
                cn = message.getJMSType();
            }
        } catch (JMSException e) {
            // ignore it
        }
        try {
            this.clazz = cn != null && !cn.isEmpty() ? load(cn) : null;
        } catch (ClassNotFoundException e) {
            throw ex.illegalStateUnableToLoadClass(e);
        }

        this.jmsMetadata = new IncomingJmsMessageMetadata(message);
        this.metadata = Metadata.of(this.jmsMetadata);
    }

@cescoffier
Copy link
Contributor

Looks good! Fancy a PR?

@cescoffier cescoffier added bug Something isn't working jms labels May 20, 2024
@neazevedo
Copy link
Author

Yes, can you made me contributor? thanks

@cescoffier
Copy link
Contributor

cescoffier commented May 20, 2024 via email

@neazevedo
Copy link
Author

done!

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants