|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Setting Expiration on JMS Messages incoming to MQ |
« View previous topic :: View next topic » |
Author |
Message
|
jay_green4 |
Posted: Fri Jan 30, 2004 2:53 am Post subject: Setting Expiration on JMS Messages incoming to MQ |
|
|
Newbie
Joined: 11 Nov 2003 Posts: 7 Location: UK
|
Hi,
I'm having a bit of a problem setting expiration on a JMS message that I am putting on to MQ. I've read a few posts on this subject but I'm not sure there is an answer that helps me.
If I set the JMSExpiration field to a value on a JMS textMessage and then use a queueSender to post it to an MQ the Expiry Interval field of the MQ message always shows as Unlimited (i.e. 0). This is the case if I enable the RFH2 header or not.
I've found that if I set the TimeToLive on the queueSender object when I post the message to MQ then MQ will be pick this value up in the Expiry Itnerval field.
It clearly says in the MQ Admin guide that I should be able to map JMSExpiration on to the Expiry field using the RFH2 header.
Has anyone else experienced this kind of problem?
I need to set expiry on a message by message basis so the only way I will be able to do this if I can't use the JMSExpiration field is by modifiying the TimetoLive on the sender every time I send a message (I guess this is OK but seems a bit of a funny way to work).
If anyone has any experience with this it would be really helpful to me.
I think this may be a general problem with my understanding of JMS as I tried doing something similar with a jms queue earlier and I experience similar behaviour (expiry set to 0 when I receive off the jms queue).
Many thanks,
Jason. |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Jan 30, 2004 6:25 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I can't say that I've messed with this myself. I just took quick look at the manual, and I think you need to use the QueueSender.send() method that takes the four parameters (message, deliveryMode, priority, timeToLive) in order to set this. If you attempt to set it by using the Message.setJMSExpiration() method, it indicates the value will be ignored. Can you show the code fragment where you are trying to set it? |
|
Back to top |
|
 |
jay_green4 |
Posted: Fri Jan 30, 2004 8:57 am Post subject: |
|
|
Newbie
Joined: 11 Nov 2003 Posts: 7 Location: UK
|
Sure. Pretty basic code :
TextMessage textMessage = session.createTextMessage(MsgText);
textMessage.setJMSCorrelationID(CorId);
textMessage.setJMSExpiration(100000);
textMessage.setJMSReplyTo(replyQueue);
textMessage.setJMSPriority(2);
//queueSender.setTimeToLive(100000);textMessage.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
queueSender.send(textMessage);
The commented line in green works. The line in red doesn't.
Incidently the same thing goes for priority. Using setJMSPriority on the text message doesn't show up on the MQ message but setting the priority on the queueSender does.
Is there anything in the manual that explicitly states I have to use the queueSender method? |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Jan 30, 2004 9:05 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I don't know if there is anything in the manual that states specifically to use the QueueSender. However, there is something that indicates NOT to use the Message. If you'll read the details under the setJMSExpiration and setJMSDeliveryMode, they both state:
Quote: |
Any value set using this method is ignored when the message is sent, ... |
This is probably implying to use the QueueSender. The QueueSender does have a couple of variations of the send() method to allow you to specify the deliveryMode, priority, timeToLive. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|