Author |
Message
|
kun.leeing |
Posted: Fri Oct 23, 2009 7:04 pm Post subject: JMSMessage Expiration |
|
|
 Disciple
Joined: 27 Sep 2008 Posts: 171
|
Hi, experts.
I set expiration value of text message by setJMSExpiration(number) and sent it to a certain queue.But its state still show infinite when I browse it on the queue.
Why?
thanks. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Oct 24, 2009 7:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Can we please see the code?
I suspect you did not set the expiration time on the send method...
This should be standard JMS practice. Maybe you should review the JMS interface... and remember that destination values often take precedence...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kun.leeing |
Posted: Mon Oct 26, 2009 5:36 pm Post subject: |
|
|
 Disciple
Joined: 27 Sep 2008 Posts: 171
|
Thanks ,saper.
And this is the part of my code.
Code: |
MessageProducer producer = sessionsnd.createProducer(destination);
TextMessage tmessage = sessionsnd.createTextMessage(msg);
tmessage.setJMSExpiration(expiredtime);
tmessage.setJMSDeliveryMode(WMQConstants.DELIVERY_NOT_PERSISTENT);
producer.send(tmessage);
sessionsnd.close(); |
I search the doc and use setTimeToLive method on producer then it works now. Does it mean we do not need setJMSExpiration on the message? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Oct 26, 2009 9:03 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
I search the doc and use setTimeToLive method on producer then it works now. Does it mean we do not need setJMSExpiration on the message? |
Did you check the documentation? I believe this property might be readonly.
The JMS way is to set it in the send method...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kun.leeing |
Posted: Fri Oct 30, 2009 1:19 am Post subject: |
|
|
 Disciple
Joined: 27 Sep 2008 Posts: 171
|
Thanks,saper.
I find out that method.  |
|
Back to top |
|
 |
v.chandramouli |
Posted: Tue Dec 22, 2009 10:30 am Post subject: JMS Message Expiration Issue |
|
|
Newbie
Joined: 22 Dec 2009 Posts: 4
|
Hi Guys,
I am facing some issue when sending messages via JMS to MQ. I am using setJMSExpiration() to set the expiration time for my TextMessages. However it is sending the non-expiry messages to the MQ. I tried with setTimetoLive() as well for the Queue sender. It didn't work.
Could you please sort out this issue as I have been struggling a lot with this issue?
Regards,
CM |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Dec 22, 2009 9:38 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Again, did you check out the multiple signatures of the send method?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
v.chandramouli |
Posted: Tue Dec 22, 2009 10:41 pm Post subject: JMS Message Expiration Issue |
|
|
Newbie
Joined: 22 Dec 2009 Posts: 4
|
fjb_saper wrote: |
Again, did you check out the multiple signatures of the send method?  |
Yes. I have checked the send(). We have only one signature of send mentod. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Dec 23, 2009 11:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Well you must have completely missed this one:
Code: |
send
public void send(Message message,
int deliveryMode,
int priority,
long timeToLive)
throws JMSException
Sends a message to the destination, specifying delivery mode, priority, and time to live.
Parameters:
message - the message to send
deliveryMode - the delivery mode to use
priority - the priority for this message
timeToLive - the message's lifetime (in milliseconds)
Throws:
JMSException - if the JMS provider fails to send the message due to some internal error.
MessageFormatException - if an invalid message is specified.
InvalidDestinationException - if a client uses this method with a MessageProducer with an invalid destination.
UnsupportedOperationException - if a client uses this method with a MessageProducer that did not specify a destination at creation time.
Since:
1.1
See Also:
Session.createProducer(javax.jms.Destination)
|
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
v.chandramouli |
Posted: Wed Dec 23, 2009 11:08 pm Post subject: JMS Message Expiration Issue |
|
|
Newbie
Joined: 22 Dec 2009 Posts: 4
|
fjb_saper wrote: |
Well you must have completely missed this one:
Code: |
send
public void send(Message message,
int deliveryMode,
int priority,
long timeToLive)
throws JMSException
Sends a message to the destination, specifying delivery mode, priority, and time to live.
Parameters:
message - the message to send
deliveryMode - the delivery mode to use
priority - the priority for this message
timeToLive - the message's lifetime (in milliseconds)
Throws:
JMSException - if the JMS provider fails to send the message due to some internal error.
MessageFormatException - if an invalid message is specified.
InvalidDestinationException - if a client uses this method with a MessageProducer with an invalid destination.
UnsupportedOperationException - if a client uses this method with a MessageProducer that did not specify a destination at creation time.
Since:
1.1
See Also:
Session.createProducer(javax.jms.Destination)
|
Enjoy  |
Thanks the response.
I already tried the above approach. It didn't work. We are using JMSAdmin tool for queue creation etc. The message expiration time which i am setting in the application is override somewhere in the application. May be in configuration files. Do you think some thing wrong in jmsadmin.config file or any other config files? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Dec 24, 2009 4:46 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Check your JNDI definition of the destination. Make sure it uses application defined and not as queue defined defaults...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
v.chandramouli |
Posted: Fri Dec 25, 2009 2:06 am Post subject: JMS Message Expiration Issue |
|
|
Newbie
Joined: 22 Dec 2009 Posts: 4
|
fjb_saper wrote: |
Check your JNDI definition of the destination. Make sure it uses application defined and not as queue defined defaults...  |
Where to find the JNDI definition? Please help me to find out. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Dec 25, 2009 11:23 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
We are using JMSAdmin tool for queue creation etc |
This is essentially inexact. You do not use JMSAdmin for queue creation. You use it for JNDI setup. The queue/Destination definition in JNDI is done via JMSAdmin. The queue creation is done with runmqsc or any tool using pcf messages.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|