smallrye / smallrye-reactive-messaging

SmallRye Reactive Messaging
http://www.smallrye.io/smallrye-reactive-messaging/
Apache License 2.0
241 stars 179 forks source link

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

Closed neazevedo closed 5 months ago

neazevedo commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

Looks good! Fancy a PR?

neazevedo commented 5 months ago

Yes, can you made me contributor? thanks

cescoffier commented 5 months ago

Hello,

You just need to fork the project in github and then open a pull request.

On Mon 20 May 2024 at 18:06, neazevedo @.***> wrote:

Yes, can you made me contributor? thanks

— Reply to this email directly, view it on GitHub https://github.com/smallrye/smallrye-reactive-messaging/issues/2625#issuecomment-2120755425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADCG7MFHKC47R3BOBKDWEDZDINSBAVCNFSM6AAAAABH7X57Y2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRQG42TKNBSGU . You are receiving this because you commented.Message ID: @.***>

neazevedo commented 5 months ago

done!

Thanks