ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » JMSMessage Expiration

Post new topic  Reply to topic
 JMSMessage Expiration « View previous topic :: View next topic » 
Author Message
kun.leeing
PostPosted: Fri Oct 23, 2009 7:04 pm    Post subject: JMSMessage Expiration Reply with quote

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
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sat Oct 24, 2009 7:35 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kun.leeing
PostPosted: Mon Oct 26, 2009 5:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Mon Oct 26, 2009 9:03 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kun.leeing
PostPosted: Fri Oct 30, 2009 1:19 am    Post subject: Reply with quote

Disciple

Joined: 27 Sep 2008
Posts: 171

Thanks,saper.

I find out that method.
Back to top
View user's profile Send private message Send e-mail
v.chandramouli
PostPosted: Tue Dec 22, 2009 10:30 am    Post subject: JMS Message Expiration Issue Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Tue Dec 22, 2009 9:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
v.chandramouli
PostPosted: Tue Dec 22, 2009 10:41 pm    Post subject: JMS Message Expiration Issue Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 23, 2009 11:34 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
v.chandramouli
PostPosted: Wed Dec 23, 2009 11:08 pm    Post subject: JMS Message Expiration Issue Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Thu Dec 24, 2009 4:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
v.chandramouli
PostPosted: Fri Dec 25, 2009 2:06 am    Post subject: JMS Message Expiration Issue Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 25, 2009 11:23 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » JMSMessage Expiration
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.