Solace PubSub+ IBM MQ Connector to send from solace through jms with non jms consumer

Options
chewaiwu
chewaiwu Member Posts: 12 ✭✭

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

  • cmorneau
    cmorneau Member, Employee Posts: 11 Solace Employee
    Options

    Hi Chewaiwu,

    IBM Documentation discusses the MQRFH2 header and interoperability with non-JMS applications here https://www.ibm.com/docs/en/ibm-mq/9.3?topic=messages-mapping-jms-onto-mq

    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

  • chewaiwu
    chewaiwu Member Posts: 12 ✭✭
    Options

    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 : '        '

  • chewaiwu
    chewaiwu Member Posts: 12 ✭✭
    Options

    Just for clarity - the question I have is how I can set the mq message property so it reflects MQSTR for format.

    If you could help and guide me how it can be done. Thank you

  • cmorneau
    cmorneau Member, Employee Posts: 11 Solace Employee
    edited January 4 #5
    Options

    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'"
    [ … ]
    

  • chewaiwu
    chewaiwu Member Posts: 12 ✭✭
    Options

    Thank you for your prompt assist. I will give this a try.

  • chewaiwu
    chewaiwu Member Posts: 12 ✭✭
    Options

    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.

  • chewaiwu
    chewaiwu Member Posts: 12 ✭✭
    Options

    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.

  • cmorneau
    cmorneau Member, Employee Posts: 11 Solace Employee
    Options

    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>

  • chewaiwu
    chewaiwu Member Posts: 12 ✭✭
    Options

    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.

This Month's Leaders