Closed Ivansamara109 closed 3 years ago
In ticket 106 sets as follows:
md.Format = MQFMT_RF_HEADER_2 + " "
but I get an header_error when I do the same
Unknown desc = MQPUT: MQCC = MQCC_FAILED [2] MQRC = MQRC_HEADER_ERROR [2142]
RFH2 structures are essentially interchangeable with message properties. It is irrelevant how the message was originally created and put to the queue - what you see when getting the message depends on the options you use for the MQGET and how the queue is configured (the PROPCTL attribute). The qmgr code will convert the message into the requested form. That might be a message with MQMD.Format=MQHRF2 followed by the RFH2 followed by the user data. Or it might be a message with MQMD.Format=
This Go package doesn't provide any special assistance for dealing with RFH2 structures (like a parser for the structure itself or the XML-like elements within it) so it's probably easier to use MsgHandle/properties approach. Though you can always build your own RFH2 processor if you want.
See the amqsprop.go sample for demonstrations of using the properties.
what you see when getting the message depends on the options you use for the MQGET
But I don't know anything about message that I receive. So how can a set MQGET options if the message parameters is unknown?
The options to MQGET that I refer to are the ones that say whether properties are returned in an RFH2 or MsgHandle. You don't need to know how the message was put; you do need to know how you are going to process the message you receive. See the documentation on the MQGMOPROPERTIES* flags.
I use MQGMO_PROPERTIES_IN_HANDLE and it seems that I need build my own RFH2 processor because MsgHandle/properties is not enough.
In addition in this case I can catch RFH headers(not RFH2) in message body if only RFH headers exists in an input message
RFH \x02\x00\x00\x00$\x00\x00\x00\"\x02\x00\x00\xb8\x04\x00\x00 \x00\x00\x00\x00\xb8\x04\x00\x00<MessageRequest/>
Is it ok when I get mqrfh2 headers in a MessageHandle?
but if other rfh2 headers exist, the body is correct
Hello
How can I get mqrfh2.Format and MQMD.Fromat?
When I get MQ message with mqmd.Format == MQSTR and empty mqrfh2 section, my application gets MQMD struct with Format == MQSTR
When I get MQ message with mqmd.Format == MQHRF2 and mqrfh2.Format == MQSTR, my application also gets MQMD struct with Format == MQSTR
How can I tell one from another when I do Get form queue?
I also found out that:
I use mq-golang v5.1.2