Solace PubSub+ IBM MQ Connector to send from solace through jms with non jms consumer
Hi, I am using Solace PubSub+ IBM MQ Connector to send from solace through jms with non jms consumer. I encounter a problem where the non-jms consumer doesn't understand MQHRF2 format. Is there a way to configure ibm mq connector to send it as MQSTR so the MQHRF2 header is not included?
Comments
-
Hi Chewaiwu,
IBM Documentation discusses the MQRFH2 header and interoperability with non-JMS applications here
Quote of interest: "The MQRFH2 is optional, and its inclusion in an outgoing message is governed by the TARGCLIENT flag in the JMS Destination class. [ … ] Normally, omit the MQRFH2 when sending a message directly to a non-JMS application. This is because such an application does not expect an MQRFH2 in its IBM MQ message."
TARGCLIENT or TargetClient can be set in 2 different ways on a destination.
If using a JNDI Destination,
targetClient
can be set on the JNDI Queue/Topic.Otherwise,
targetClient
can be specified directly in the connector config when using a URI formatted queue or topic. For instance:spring: cloud: stream: bindings: input-0: destination: Solace/Queue/0 # Queue name binder: solace output-0: destination: queue:///DEV.QUEUE.1?targetClient=1 binder: jms
I hope this helps
2 -
Hi, it seems there is still issue I'm encountering with the mq message sent. For some reason, Format is blank and is not being set to MQSTR.
Would you be able to tell me how Format can be configured to MQSTR?
StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : 501965 Feedback : 0
Encoding : 273 CodedCharSetId : 1208
Format : ' '0 -
My understanding is that the Message Type determines the Format. For instance, I believe
MQSTR
is set automatically if the IBM MQ Connector bridges a Solace TextMessage to an IBM MQ JMSTextMessage.However, if you want to ensure it is set regardless of Message Type, you should be able to set the
JMS_IBM_Format
header using the Header Transform feature as follows:[ … ] solace: connector: workflows: 0: enabled: true transform-headers: expressions: JMS_IBM_Format: "'MQSTR'" [ … ]
1 -
That worked. But have one more question.. Sorry I am new to this connector and trying to figure it out.
It seems expiry is set to 604424 and I tried overriding it with below config.
solace.connector.workflows.0.transform-headers.expressions.JMSExpiration=214748365
But it doesn't seem to have an effect. Is there something wrong with what I'm doing?
Thanks you.
0 -
It seem "The property name 'JMSExpiration' is reserved and cannot be set."
Found below in log - can you advise if there is a way to set time-to-live for the message?
2024-01-06 04:57:45.218 WARN 52491 --- [pool-7-thread-1] c.s.s.c.s.b.j.u.CustomJmsHeaderMapper : failed to map Message header 'JMSExpiration' to JMS property
com.ibm.msg.client.jms.DetailedMessageFormatException: JMSCC0050: The property name 'JMSExpiration' is reserved and cannot be set.
0 -
That is correct, JMSExpiration is a read only property in JMS.
Using Header Transform, you should be able to set
jms_timeToLive
as follows:[ … ] transform-headers: expressions: jms_timeToLive: "headers.solace_timeToLive" [ … ]
Note that original headers from the Solace message can be accessed in the SPeL expression with
headers.<solace_header>
0 -
Hi, I set the config with this - solace.connector.workflows.0.transform-headers.expressions.jms_timeToLive=0L
But when the message arrives at the IBM MQ queue, it still shows "Expiry : 604039" on the message header. Am I setting it correctly? I didn't see any error in log.0