MQ

 View Only
  • 1.  Adding MQRFH2 headers to MQMessage in C#

    Posted Wed April 21, 2021 09:28 AM
    Hello! I need to send a MQMessage in .NET C# with specific JMS-Properties in the MQRFH2-header. The properties need to end up in the <ur>-tag for the target system to be able to use them properly. Because of this we can't use neither XMS nor SimpleMessageProperties. Any help would be greatly appreciated!

    ------------------------------
    Daniel Jonsson
    ------------------------------


  • 2.  RE: Adding MQRFH2 headers to MQMessage in C#

    Posted Thu April 22, 2021 02:41 AM
    SimpleMessageProperties sample puts the properties under RFH folder as shown in picture below. Could you please let us know reason why you think SimpleMessageProperties does not suit your requirement? 

    Thank you


    ------------------------------
    Shashikanth Rao Thambrahalli
    IBM
    ------------------------------



  • 3.  RE: Adding MQRFH2 headers to MQMessage in C#

    Posted Mon April 26, 2021 03:09 AM
    Thanks for your reply. When we send a message using SimpleMessageProperties to our integration platform, it does not accept it giving an error that the field "JMSProperties" is missing. We have a working Java program that sets the properties directly onto a MQRFH2-header object and then writes it to the message, but I can't find a way to do that using C# .NET.

    ------------------------------
    Daniel Jonsson
    ------------------------------



  • 4.  RE: Adding MQRFH2 headers to MQMessage in C#

    Posted Mon April 26, 2021 06:12 AM
    Thanks for clarifying. Unlike MQ Java, MQ .NET does not provide RFH2 classes. XMS .NET supports setting properties in a RFH2 folder. I know you mentioned XMS is not an option for you. I think you will have to build yourself the RFH2 header and required properties into the message using the various write methods of MQMessage class.

    Thanks
    Shashi

    ------------------------------
    Shashikanth Rao Thambrahalli
    IBM
    ------------------------------



  • 5.  RE: Adding MQRFH2 headers to MQMessage in C#

    Posted Tue April 27, 2021 02:29 AM
    I found an example from 2006 that I think does this, but the example has unfortunately been deleted so I can't check back on it. In Java you can do mqrfh2.write(mqmessage), but do you have any pointers on how to do the same in C#?

    The example I found uses a structure definition with MQRFH2-headers but I don't know how to use this with the MQMessage:
            public struct MQRFH2
            {
                public String StrucId;
                public int Version;
                public int StrucLength;
                public int Encoding;
                public int CodedCharSetId;
                public String Format;
                public int Flags;
                public int NameValueCCSID;
    
                public MQRFH2(string sStrucId, int iVersion, int iStrucLength, 
                int iEncoding, int iCodedCharSetId, string sFormat, int iFlags, int iNameValueCCSID)
                {
                    StrucId = sStrucId;
                    Version = iVersion;
                    StrucLength = iStrucLength;
                    Encoding = iEncoding;
                    CodedCharSetId = iCodedCharSetId;
                    Format = sFormat;
                    Flags = iFlags;
                    NameValueCCSID = iNameValueCCSID;
                }
            }​


    ------------------------------
    Daniel Jonsson
    ------------------------------