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 :-)
Related
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 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.
I want to send PDFs via camel route to an ActiveMQ queue.
I need to extract these PDFs in another camel route.
Im not able to extract the data from the queue. I also tried it with .marshal().base64(). The Data reaches the Message Broker but I can't extract it.
Following Error will appear:
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/util/backoff/BackOff
at org.apache.camel.component.jms.JmsConfiguration.chooseMessageListenerContainerImplementation(JmsConfiguration.java:466)
at org.apache.camel.component.jms.JmsConfiguration.createMessageListenerContainer(JmsConfiguration.java:456).....
Does anybody has an idea?
The Object is org.apache.camel.converter.stream.InputStreamCache when using base64 marshalling.
The Object is org.apache.camel.component.file.GenericFile when just sending the pdf to the queue.
How can I extract the data to get that PDF back?
Here is the Code to deliver two different queues. But I can't extract data even of one.
from("file:src/main/resources/test?noop=true")
.to("jms:queue:PDF")
.marshal().base64()
.to("jms:queue:BASE64_PDF")
this example works well
from("file:src/main/resources/test?noop=true")
.to("jms:queue:PDF");
from("jms:queue:PDF")
.to("file:src/main/resources/testReceive");
it is dependencies problem not Camel, verify that you have spring-core-x.x.x.jar or activemq-all-x.x.jar in the classpath
I'm trying to use rubywmq gem to publish message to a IBM MQ pub/sub topic. I do not see any direct way of publishing to topic from Ruby code.
Following is the MQ TOPIC, SUB setup MQSC:
DEFINE TOPIC(MY_TOPIC) TOPICSTR('COM/APP')
DEFINE QALIAS(MY_TOPIC_Q) TARGET(MY_TOPIC) TARGTYPE(TOPIC)
DEFINE QLOCAL(APP.RAW.INPUT)
DEFINE QLOCAL(APP.VALIDATOR.INPUT)
DEFINE QLOCAL(APP.ENRICHER.INPUT)
DEFINE QLOCAL(APP.XFORM.INPUT)
DEFINE QLOCAL(APP.LOGGER.INPUT)
DEFINE SUB(SUB.APP.RAW.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/RAW') DEST(APP.RAW.INPUT)
DEFINE SUB(SUB.APP.VALIDATOR.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/XML') DEST(APP.VALIDATOR.INPUT)
DEFINE SUB(SUB.APP.ENRICHER.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/VLD') DEST(APP.ENRICHER.INPUT)
DEFINE SUB(SUB.APP.XFORM.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/ENR') DEST(APP.XFORM.INPUT)
DEFINE SUB(SUB.APP.LOGGER.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('#') DEST(APP.LOGGER.INPUT)
I also tried publishing to alias queue for the topic with MQRFH2 header
Ruby Code:
WMQ::QueueManager.connect(:connection_name => conn_name, :channel_name => channel_name, :q_mgr_name=> queue_manager) do |qmgr|
message = WMQ::Message.new
message.data = 'Hello World'
message.headers = [
{
header_type: :rf_header_2,
xml: ['<route>COM/APP/MSG/RAW</route>']
}
]
message.descriptor[:format] = WMQ::MQFMT_STRING
qmgr.put(q_name: 'MY_TOPIC_Q', message: message )
end
And then add a SUB with selector like:
DEFINE SUB(SUB.APP.RAW.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/RAW') DEST(APP.RAW.INPUT) PSPROP(RFH2) SELECTOR('route = ''COM/APP/MSG/RAW''')
Couldn't succeed. Could anyone please point where the problem is or suggest an alternative? Thanks.
Software Version Used:
IBM WMQ Server & Client v7.5
Ruby v2.3.0
rubywmq v2.1.1
Putting a message to an alias over a topic is a method to convert point-to-point apps to pub/sub. Since the API call is PUT and not PUBLISH, there is no mechanism to add a topic string to the prefix supplied by the topic object. The messages are published to the topic string as defined in the topic object and no further. Your SUB.APP.LOGGER.INPUT subscription should be seeing the publications, but not the other ones.
There are several other issues in the posted code. The crafting of an RFH2 header suggests you are relying on docs from perhaps as early as v5.3 or v6. Unfortunately, there is no mention of which version the MQ server is at or which version client libraries are being used by Ruby.
There is also no mention of what you meant by "Couldn't succeed." Does that mean you saw zero publications, even on SUB.APP.LOGGER.INPUT pub appeared to PUT messages OK? Or the PUT returned a bad reason code? Or that you got messages on SUB.APP.LOGGER.INPUT but nowhere else?
For debugging purposes, you can use MQ Explorer, the amqsput sample, or any of the other supplied tools to drop a message onto the alias queue and look for output. The difference between that test and your Ruby testing should help diagnose the issue.
Please do come back and update your question with additional details if you'd like a less speculative response.
The QALIAS must point to a TOPIC object specific to the TOPICSTR you want to publish to. Example:
DEFINE TOPIC(MY_TOPIC_MSG_RAW) TOPICSTR('COM/APP/MSG/RAW')
DEFINE QALIAS(MY_TOPIC_Q) TARGET(MY_TOPIC_MSG_RAW) TARGTYPE(TOPIC)
I am generating emails using Spring JavaMail and Velocity Template to send to the customer.I have to store these outgoing Emails into some folder in .MSG format.I did so much research on the web.But not able to find right Java API to do this.And in Spring Java Mail I am not able to find writeTO() method which is in JavaX.mail API.Can some one help me with this issue.
You already found that javax.mail.Part has a writeTo method.
So what you need is a way to "convert" a spring simple mail to an javax.mail
It should work more or less this way:
org.springframework.mail.javamail.MimeMailMessage message
message = new MimeMailMessage(new SmartMimeMessage(getSession(),
getDefaultEncoding(),
getDefaultFileTypeMap()));
yourSimpleMessage.copyTo(message);
javax.mail.internet.MimeMessage result = message.getMimeMessage());
result.writeTo(yourOutputStream);