JMS message format type - format

We are trying to use JMS to communicate with IMS region. The message reaches IMS and gets dropped since the message is not in the "required" format i.e. MQIMS.
How do we set the message sent from JMS code in MQIMS format? Is there an explicit way of setting the message format in the header? Do we need to set the LL, ZZ segments or do they get set automatically?

There is a property on your JMS container called something like "targetServer". Changing that to reflect MQ or MQIMS will prevent the sending of the MQRFH2 header and should fix your problem.

Related

JMS API encoding issue when IBM MQ message is TEXT+BINARY

I am consuming message from IBM MQ queue. Messages are of format MQSTR. But message data is TEXT+Binary. This Binary data is nothing but a JPG image
When these messages are consumed by my JMS consumer, I can see some encoding issue for Binary data, due to which transformed image is distorted from original.
I have tried every possible aspect (different IBM specification). But was not able to make through.
If someone already faced such issue please suggest possible solution for it.
If the message has an MQSTR MQMD.Format, then it must be a text string. MQ will convert text strings between codepages when required (eg ASCII to Unicode). If the message is not meant to be a string - which it sounds like from your limited description - then whoever creates the message needs to set the format suitably, and the receiving app must be prepared to parse and convert the message body components.

IBMMQ, under what scenario will MQMD.MsgType=1 be interpreted as MQMT_SYSTEM_FIRST instead of MQMT_REQUEST

We are using JmsTemplate to send messages to an IBM MQ's local queue. We set MQMD property MsgType to 1, but when viewing the message header from the queue, the value is interpreted as MQMT_SYSTEM_FIRST instead of MQMT_REQUEST. Why is that? Is this the reason why the other party's system cannot return the reply message?
We are doing debugging with another system. According to their feedback, they checked our message header in the queue like this.
enter image description here
But based on past experience, our message should look like this (Please focus only on the MsgType field).
enter image description here
And there is no clue as to why these two different situations occur. Their values are both 1, but MQMT_SYSTEM_FIRST and MQMT_REQUEST are displayed respectively.
I suspect this is just a flaw in whatever you use to view the header in that it does not realize MQMT_SYSTEM_FIRST is never 'set', it is just a range identifier.
What are you using to view the header?
This question is really a duplicate of IBM MQMD header how to distinguish

HornetQ message splitter

I'm new to JMS and HornetQ.
I'm wondering if there is a way to implement Message Translator Pattern using HornetQ to split data from a message in a set of smaller data and send them. I explored Bridge and Divert solutions but I can't get how to do it using org.hornetq.core.server.cluster.Transformer and org.hornetq.core.server.ServerMessage. Where can I find some docs about it? Am I looking in the right direction?
In short no(I've no Idea on camel). You cannot modify the jms body once sent until its consumed by a client(body is immutable). However you can change message headers and message properties. The org.hornetq.core.server.cluster.Transformer interface is used for modifying the headers/properties. Hence you are left with two options.
Consume the message, chunk the message based on your algorithem and send to other queues or put back to the queue(but be careful to avoid loop, by having suitable selector).
Other approach is chunk the message then send with message property to differentiate the message. And use the diverter with filter based on the message property(you can use exclusive/non exclusive strategy to send only/send copy of message to the other queue.)

TimeToLive on Camel response messages

When using an InOut paradigm to send request/response messages to a JMS endpoint, the Camel JMS documentation describes how to set a message expiration on the request message, but it doesn't describe whether the response message will have a timeout (JMS expiration) set when it's sent by the consumer of the request message. The documentation does describe the replyToDeliveryPersistent URI option that the consumer can set to specify that the response message it sends should be non-persistent, but I don't see anything that would let you specify whether the response message will have an expiration date set.
Is there some way to ensure that response messages will be expired (so they can be automatically removed from the broker) if they are unconsumed for a certain amount of time (e.g. because the producer of the request was killed before it read the response to its final request), without implementing a custom ActiveMQ consumer and losing the benefits of using Camel? I control both the producer and the consumer, so the changes can happen at whichever side they need to be made (and I'm aware that the consumer end is the place this would likely need to be done); the sole criterion here is that Camel must remain the method for processing the message and responding with a reply message, because having to implement that by hand would be worse than living with persistent reply messages.
The only way to set an expiration time (JMSExpiration header) on a message is from its production point (i.e. by the producer).
In your case, the consumer of your request should set the JMSExpiration date explicitly1, using the JMS component's URI option timeToLive, and there is no way to set this option from the requesting side.
1) JMS specification points out that instead of setting the JMSExpiration directly, JMS clients should specify the time-to-live. The header is then calculated as the sum of the time-to-live and the current GMT value.

Single-threading in Websphere application

In CICS we have something called a ENQ command which is useful for single-threading based on desired values . Similarly do we have anything in Websphere?
ie., I want my MDB to read multiple messages from the input queue. However I want to process the messages strictly in the received order. Setting the value of 'Server session' in the activation spec property to 1 will achieve this but I want to do it programatically within my MDB
Below is a quote from JMS 1.1 specification. It seems that ordering is only guaranteed if you send messages from a single session; in that case the sessions input message stream will be ordered. Since no API exists for limiting session count, I guess you must depend on server facilities for this configuration.
4.4.10 Message Order JMS clients need to understand when they can depend on message order and when they cannot.
4.4.10.1 Order of Message Receipt Messages consumed by a session
define a serial order. This order is important because it defines the
effect of message acknowledgment. See Section 4.4.11 ”Message
Acknowledgment,” for more details. The messages for each of a
session’s consumers are interleaved in a session’s input message
stream. JMS defines that messages sent by a session to a destination
must be received in the order in which they were sent (see Section
4.4.10.2 ”Order of Message Sends,” for a few qualifications). This defines a partial ordering constraint on a session’s input message
stream. JMS does not define order of message receipt across
destinations or across a destination’s messages sent from multiple
sessions. This aspect of a session’s input message stream order is
timing-dependent. It is not under application control.

Resources