MQ Adapter custom adhoc headers

We have a requirement to inject custom headers into webSphere MQ Adapter services. The MQMD header is not an option as that doesn’t allow for other values. So trying to add them to the MQRFH2 header by using the JMSProperties tab. But the adapter doesn’t let us add headers that are not declared in the service inputs.

Is there a way to achieve this ?

@rupinder1 One of the community member raised this few years back. Pls check the below thread.

It’s always suggested to use user defined header option under JMS headers, for any specific detail user need to send as part of message and to track same after receiving.

But the user defined headers under JMS are required to be added at design time. Anything that is not in that definition is automatically excluded. So it’s not truly adhoc

Consider using a mediation module in IBM Integration Bus (IIB) or App Connect Enterprise (ACE) to inject custom headers into WebSphere MQ messages. This allows for greater flexibility in manipulating message headers and properties, even if they are not explicitly declared in the service inputs. The mediation flow can be customized to add the necessary headers to the MQRFH2 header.

I was the one who requested the original feature request back in 2019 from SAG for support to MQIIH headers but it seems they did not make any headway on it. You can do the same thing i did by using the IBM MQ classes to create a Java service to inject the needed headers in to the message for sending outbound messages to the MQ Queue.

For MQIIH i used below code to inject the headers. You might have to do the same for MQRFH2 headers. Look at this Stack overflow question.

MQIIH IIHeader=new MQIIH();

MQHeaderList headers=new MQHeaderList();