I am sending XML message to AMQ queue. XML has header section. I need to set child nodes of header as properties of AMQ message. I am using NodeJS stompit package.
Currently message shows only one property which is JMSXDeliveryCount.
The stompit documentation has an example where the destination and content-type headers are set when using the client.send method. You can add whatever other headers you want there.
Related
I try to build an xml message to inject it in IBM MQ.
The format to be used should be RFH2. Do you know, do you have any documentation about the format (xsd?) of the header?
Thank you.
MQ's RFH2 is an extensible header consisting of a fixed-format binary structure followed by a variable portion with an XML-like syntax.
The structure is described (in basic terms) in the Knowledge Center here:
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.ref.dev.doc/q099070_.htm
Some MQ clients (for example JMS and .NET) will automatically prefix the messages they send with an RFH2 header. If you are using one of these clients then you might not need to encode the RFH2 yourself - it will be added for you.
Do you have any more information about why the application needs an RFH2 header?
The RFH2 is often used to carry message properties so you will need to ensure that you encoded these correctly if you are building your own RFH2.
If the application is using the MQ JMS or .NET client then it will be expecting the RFH2 header in the message to be formatted as described in the following topic:
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q032000_.htm
You may find the following utility program (rfhutil) helpful in understanding the RFH2 header and debugging your application:
https://github.com/ibm-messaging/mq-rfhutil
Note that the variable portion of the RFH2 header uses an XML-like syntax but does not support or understand all the features of XML, so you should not attempt to include your XML payload in the variable portion of the RFH2 header.... Instead the XML document should follow the RFH2 in the message.
One last point to note is that MQ can perform codepage conversions based on the format and CCSID of the message, but this is rarely what you want with an XML document (which typically describes the character encoding of the document it's own declaration like this: <?xml version="1.0" encoding="UTF-8" standalone="no" ?>. I would therefore recommend that you set the Format field in the RFH2 to "MQFMT_NONE" so that the XML document is treated as binary data and not converted unnecessarily when the message is received by the MQ client.
Using Spring's JmsTemplate message.setStringProperty("param", "value") one can set the value in MQRFH2.usr. How can we set values in MQRFH2.other?
I'm not a JMS guy but I do know how to do it with regular MQ/Java API.
You use the MQRFH2 class and use the setFieldValue method:
rfh2.setFieldValue("other", "SomeText", "TEST");
I cannot find where I posted my program MQTest71.java on StackOverflow but you can find a write up on my blog here.
Update 2020/01/14:
This afternoon I played around with MQ/Java programs that created various folders in an MQRFH2 message and then ran MQ/JMS programs to retrieve the messages. MQ/JMS programs simply ignore all folders outside of 'mcd', 'jms' and 'usr'.
Therefore, you need to put the name/value properties in the 'usr' folder if you want MQ/JMS applications to access the information.
According to MQ 9.1.x>Reference>Developing applications reference>MQI applications reference>Properties specified as MQRFH2 elements>Supported MQRFH2 folders there is no other folder.
The folders <jms>, <mcd>, <mqext>, and <usr> are described in The MQRFH2 header and JMS. The <usr> folder is used to transport any JMS application-defined properties that are associated with a message. Groups are not allowed in the <usr> folder.
I'm in the process of upgrading to NiFi 1.2 and have noticed something with the InvokeHTTP on 1.2 where the content view is unable to display the Content of a response.... This same flow is working fine in our 1.1.x cluster. We're doing a GET that returns a JSON response. I look at the Flowfile Attributes in the paused queue, and the Content-Type seems to be set correctly to application/json. I've even tried to send downstream to an UpdateAttribute and change the mime.type to text/plain.
I'm able to download the file and it looks fine...
Is there some setting/configuration in 1.2 that I need to set to allow the viewer to view the JSON Content?
Below is some screenshots of the viewer.
I am trying to use the rest API to dynamically update and control my Apache NiFi Flow. I am using Postman to explore the REST API but am having trouble deleting properties/descriptors.
My current process is to call a GET to this address - http://localhost:8080/nifi-api/processors/{ID}
I then modify the response as desired and do a PUT with the modified response as the body. If I add a descriptor or change the content of a descriptor it works ok. But if I try to delete a descriptor by removing it from the properties and descriptors area then nothing happens.
I still get a 200 OK response, but it is the same as the original.
I am using NiFi 1.1.2 on Windows.
The PropertyDescriptors are specified by the Processor in question. These are read-only values and describe the properties the Processor currently supports. In you want to remove a property, and it is optional, you should be able to remove the value for it by setting it's entry to null in properties object in your request.
I try to create & send JMS messages with HermesJMS to a queue but the field messageID isn't editable...
How can I set it ?
Screen shot: Creation of a new message in HermesJMS
Thanks for your help.
I found no solution to my problem...
So the best way to avoid using the default new JMS message feature of HermesJMS is to send a XML file of the JMS message...
Afore that you need of course to write the XML file "by hand" and define all needed fields including among others things the messageId field :-)