Author |
Message
|
bj1980 |
Posted: Fri Jun 09, 2006 10:07 am Post subject: MQMessage.expiry = int does not seem to work |
|
|
Newbie
Joined: 09 Jun 2006 Posts: 5
|
So, I'm trying to implement the expiry field for a client. My code runs something like this.
MQMessage myMessage = new MQMessage();
myMessage.writeString(myXMLResult.toString());
String resultTypeName = myXMLResult.getRootTagName();
Integer expiry = (Integer)expiryTimes.get(resultTypeName );
if(expiry != null) {
myMessage.expiry = expiry.intValue();
}
I don't know much about MQ. However, if I understand correctly, this is processed through an IBM MQ with an MSMQ bridge. Can anyone give me insight as to why my message is coming out with the value of Unlimited for expiry? The expiry value is 2000.
I do not have an MQ running. So, I cannot validate the header, but I know that expirytimes has the right times and types in it. So, I should have that, but.....
Help! |
|
Back to top |
|
 |
wschutz |
Posted: Fri Jun 09, 2006 10:33 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Please explain what you are doing ... are you using the WebSphere MQ client to put messages into MSMQ via the bridge? Are you looking at the messages in MSMQ? _________________ -wayne |
|
Back to top |
|
 |
bj1980 |
Posted: Fri Jun 09, 2006 10:49 am Post subject: |
|
|
Newbie
Joined: 09 Jun 2006 Posts: 5
|
My program takes in some information from another piece of software. I create an MQ message from that information and send the MQ message response back. I would like to include an expiry time so that a message can automatically be removed from the queue after a set amount of time has expired. The program that this message will be sent back to is running MSMQ (Microsoft) and my program runs on a server with IBM MQ Series installed and running. Therefore, the expiry must be translated into an MSMQ expiry when it is delivered to the other server.
Is that enough info? I'm not sure I can give much more since I do not know MQ that well, nor am I supremely familiar with the client's system. I am just trying to figure out the programming angle on this so that I know whether I have done my job or not. If I have done my job, then I can let the client focus on the settings. If I have not done my job, I will need to fix my code to do the right job.
Thanks in advance! |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Jun 10, 2006 5:45 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
There will have to be some sort of bridge application between IBM WebSphere MQ and MSMQ.
That bridge will have to handle the proper conversion of the MQMD.Expiry into the equivalent field on the MSMQ message.
Your job is to make sure that the MQMD.Expiry is properly set.
You will have to do this by testing locally, and knowing enough about MQ to say for sure that your code is doing what it should.
You need a queue manager to perform this testing, and a queue you can put messages onto. Then you can use the sample program amqsbcg to look at the headers on the messages you produce and see what the Expiry is set to.
The code you posted looks reasonable for setting an expiry - but that's only at a quick glance when I haven't had enough coffee. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bj1980 |
Posted: Mon Jun 12, 2006 7:39 am Post subject: |
|
|
Newbie
Joined: 09 Jun 2006 Posts: 5
|
How could I find out that bridge? If the client doesn't know, how do I find that out?
Due to previous commitments, I do not have a Queue available to me for this project. How could I work this if I do not have a Queue available? How can I validate this?
Thanks for all the help! |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 12, 2006 7:10 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
By the way you were talking about setting an int. Does the API specify an int or a long?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
8davitt |
Posted: Tue Jun 13, 2006 2:29 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2003 Posts: 37 Location: Seated in front of monitor
|
Websphere Using Java manual Chapter 9 states
MQMessage.expiry public int expiry
Default value MQC.MQEI_UNLIMITED, meaning that the message never expires.
Looks like you are picking up the default value. Perhaps you should add some debug code?
Integer expiry = (Integer)expiryTimes.get(resultTypeName );
if(expiry != null) {
System.out.println("Setting expiry value to : + expiry.intValue() );
myMessage.expiry = expiry.intValue();
}
/s |
|
Back to top |
|
 |
bj1980 |
Posted: Tue Jun 13, 2006 6:13 am Post subject: |
|
|
Newbie
Joined: 09 Jun 2006 Posts: 5
|
I think that's the best option at this point. I'll do that and make sure that the code is working. Then, if it still doesn't work, we'll know it's settings.
Thanks! |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 13, 2006 6:45 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Good luck getting past your "new MQQueueManager()" call without a queue manager to connect to. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bj1980 |
Posted: Tue Jun 13, 2006 6:49 am Post subject: |
|
|
Newbie
Joined: 09 Jun 2006 Posts: 5
|
Jeff, the client has the queue manager and it gets set up earlier in the code. This application works. It is solely the expiry that has not been working. So, I'm going to give the client the code to test and see if this message shows up in my log. If it does not, then I know we're not hitting the right code. If it does, then it is likely client settings. So, thanks for the good luck! I'll use it! =) |
|
Back to top |
|
 |
|