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

alpakka jms does not support null message properties #2690

Closed
BertRobben opened this issue Jun 18, 2021 · 3 comments
Closed

alpakka jms does not support null message properties #2690

BertRobben opened this issue Jun 18, 2021 · 3 comments
Labels
Milestone

Comments

@BertRobben
Copy link

The Alpakka implementation does not support null values for JMS message properties. Looking at the spec (https://javaee.github.io/javaee-spec/javadocs/javax/jms/Message.html), this is a valid practice.

"As noted above, property values may be NULL. "

Trying to use them with alpakka jms however yields an exception.

stack_trace: akka.stream.alpakka.jms.NullMessageProperty: null value was given for Jms property '_wb_tx_uid'. at akka.stream.alpakka.jms.impl.JmsMessageProducer.$anonfun$populateMessageProperties$1(JmsMessageProducer.scala:88) at akka.stream.alpakka.jms.impl.JmsMessageProducer.$anonfun$populateMessageProperties$1$adapted(JmsMessageProducer.scala:77) at scala.collection.immutable.BitmapIndexedMapNode.foreach(HashMap.scala:1076) at scala.collection.immutable.HashMap.foreach(HashMap.scala:1083) at akka.stream.alpakka.jms.impl.JmsMessageProducer.populateMessageProperties(JmsMessageProducer.scala:77) at akka.stream.alpakka.jms.impl.JmsMessageProducer.send(JmsMessageProducer.scala:23) at akka.stream.alpakka.jms.impl.JmsProducerStage$$anon$2.$anonfun$sendWithRetries$1(JmsProducerStage.scala:165) at

And the code from akka.stream.alpakka.jms.impl.JmsMessageProducer (line 88) clearly specifically throws an exception on null properties.

The expected behavior is that alpakka follows the jms spec and allows null properties.

We're using Alpakka JMS 2.0.2

@ennru ennru added the p:jms label Jun 21, 2021
@ennru
Copy link
Member

ennru commented Jun 21, 2021

Thanks for reporting. Would you be in a position to suggest the necessary changes?

@BertRobben
Copy link
Author

Company policy doesn't allow me to contribute source code directly.

But from reading the code in JmsMessageProducer, I would expect

      case null => throw NullMapMessageEntry(key, jmsMessage)

should be replaced by

      case null => message.setObject(key, null)

And that on line 88.

@ennru
Copy link
Member

ennru commented Sep 3, 2021

Fixed by #2725

@ennru ennru closed this as completed Sep 3, 2021
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

2 participants