Author |
Message
|
siljcjose |
Posted: Wed May 14, 2008 12:04 am Post subject: Setting MQMD.Expiry value |
|
|
Apprentice
Joined: 18 Aug 2005 Posts: 27
|
Hi,
I have a simple requirement that the message in a input queue has to expire after 3 months, if the message is not picked up from the queue.
I put a simple line like this SET OutputRoot.MQMD.Expiry = CAST((CURRENT_TIME + INTERVAL '1' SECOND ) AS GMTTIMESTAMP);
But now when i change this to
When i cahne it to this statement SET OutputRoot.MQMD.Expiry = CAST((CURRENT_TIME + INTERVAL '3' MONTH ) AS GMTTIMESTAMP); it throws an exception at runtime as illegal interval operation.
Please can any one help me with the syntax.
Thanks. |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 14, 2008 12:33 am Post subject: Re: Setting MQMD.Expiry value |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
siljcjose wrote: |
Please can any one help me with the syntax.
|
The syntax is fine. The problem is the expiry value is not a timestamp - it's the number of milliseconds left before the message expires.
I don't know if the field is large enough to hold enough milliseconds for 3 months (and too lazy to multiply the value out anyway), but shudder to think at a system where messages sit for 3 months without being processed!
3 minutes unprocessed make some site gibber (which is why it's an interval). _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sri_csee1983 |
Posted: Wed May 14, 2008 12:33 am Post subject: |
|
|
 Centurion
Joined: 25 Mar 2008 Posts: 125 Location: Chennai,India
|
Since I havent used Expiry in Set Stmt of broker,
As u told it is working for
SET OutputRoot.MQMD.Expiry = CAST((CURRENT_TIME + INTERVAL '1' SECOND )
Did u try with
SET OutputRoot.MQMD.Expiry = CAST((CURRENT_TIME + INTERVAL '7776000' SECOND )
which is the seconds for 90 days.
? May be working.  _________________ With Cheers,
Sri |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 14, 2008 12:36 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sri_csee1983 wrote: |
which is the seconds for 90 days.
|
We're both wrong about Expiry - I'm wrong about it being milliseconds, you're wrong about it being seconds.
It's tenth of a second.
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
siljcjose |
Posted: Wed May 14, 2008 1:34 am Post subject: |
|
|
Apprentice
Joined: 18 Aug 2005 Posts: 27
|
Thanks for the reply.
I changed the code do this and i got the expected behavior.
SET OutputRoot.MQMD.Expiry = CAST((CURRENT_DATE + INTERVAL '3' MONTH) AS GMTTIMESTAMP); |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 14, 2008 2:01 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
siljcjose wrote: |
Thanks for the reply.
I changed the code do this and i got the expected behavior.
SET OutputRoot.MQMD.Expiry = CAST((CURRENT_DATE + INTERVAL '3' MONTH) AS GMTTIMESTAMP); |
Did you verify that the message would indeed expire after 3 months? I would have expected to find your value in the OutputRoot.Properties....
For MQMD:(verify the syntax as I'm working from memory here)
declare expval integer value 0;
SET expval = cast (Interval '3' month) AS interval seconds;
SET expval = expval * 10;
SET OutputRoot.MQMD.Expiry = expval;
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
joebuckeye |
Posted: Wed May 14, 2008 6:32 am Post subject: |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
The Expiry field in the MQMD is a special case. The Info Center has this blurb about the Expiry field:
Quote: |
The Expiry field in the MQMD is a special case:
- An INTEGER value represents an expiry interval in tenths of a second. If the Expiry field is set to -1, it represents an unlimited expiry interval (that is, the message never expires) If the Expiry field is a positive INTEGER, it represents an expiry interval of that number of tenths of a second (for example, if it is set to 4, it represents 4 tenths of a second, if it is set to 15, it represents one and a half seconds).
- A GMTTIMESTAMP value represents a specific expiration time.
If Expiry contains a GMTTIMESTAMP in the past, or an INTEGER of less than 1 (excluding -1), it is set to the value 1 (one tenth of a second, the minimum value). |
So it can be an integer or a timestamp. |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 14, 2008 7:09 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
|
Back to top |
|
 |
siljcjose |
Posted: Wed May 14, 2008 12:08 pm Post subject: |
|
|
Apprentice
Joined: 18 Aug 2005 Posts: 27
|
Though i gave a Timestamp value as this (CAST((CURRENT_DATE + INTERVAL '3' MONTH) AS GMTTIMESTAMP) , when i tried browsing the message for which the expiry was set to 3 months i could see the interval in 10's of second. ie a value of 77760000, which was ticking down each time i browsed. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 14, 2008 2:22 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
siljcjose wrote: |
Though i gave a Timestamp value as this (CAST((CURRENT_DATE + INTERVAL '3' MONTH) AS GMTTIMESTAMP) , when i tried browsing the message for which the expiry was set to 3 months i could see the interval in 10's of second. ie a value of 77760000, which was ticking down each time i browsed. |
Yup looks like 90 days in 10ths of seconds.
Congrats. it works
The interval vs GMTTIMESTAMP seems to be a 6.1 feature:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ad09700_.htm _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 14, 2008 11:20 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Is there no limit to the advances possible to those clever people at IBM?
I have so got to get me some time with WMBv6.1!  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
joebuckeye |
Posted: Thu May 15, 2008 5:38 am Post subject: |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
|
Back to top |
|
 |
|