alpakka
alpakka copied to clipboard
Setting AccountingToken property on MQ using alpakka
Versions used
Alpakka version: 3.0.4
Akka version: 2.6.19
Expected Behavior
I am trying to set JMS_IBM_MQMD_AccountingToken property for an MQ Message which is required to be a byte array as per: https://www.ibm.com/docs/en/ibm-mq/7.5?topic=descriptor-message-object-properties
However, byte array is non standard Jms and not supported by alpakka as it throws an exception when creating the message. https://www.ibm.com/docs/en/ibm-mq/7.5?topic=descriptor-message-object-properties#q032350___q032350_4
Actual Behavior
based on the code here: an exception is thrown when sending the message after adding:
val accountingToken = Array[Byte](1, 1, 1, 1, 1, 1, 1, 1, 1)
message.withProperties(Map(JmsConstants.JMS_IBM_MQMD_ACCOUNTINGTOKEN -> accountingToken ))
https://github.com/akka/alpakka/blob/master/jms/src/main/scala/akka/stream/alpakka/jms/impl/JmsMessageProducer.scala#L89
Relevant logs
Caused by: akka.stream.alpakka.jms.UnsupportedMessagePropertyType: Jms property 'JMS_IBM_MQMD_AccountingToken' has unknown type '[B'. Only primitive types and String are supported as property values. at akka.stream.alpakka.jms.impl.JmsMessageProducer.$anonfun$populateMessageProperties$1(JmsMessageProducer.scala:89) at akka.stream.alpakka.jms.impl.JmsMessageProducer.$anonfun$populateMessageProperties$1$adapted(JmsMessageProducer.scala:77) at scala.collection.immutable.Map$Map3.foreach(Map.scala:448) 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)
Reproducible Test Case
Please provide a PR with a failing test.
If the issue is more complex or requires configuration, please provide a link to a project that reproduces the issue.