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 API Support » setting MQMD_EXPIRY from XMS application

Post new topic  Reply to topic
 setting MQMD_EXPIRY from XMS application « View previous topic :: View next topic » 
Author Message
darin.brown
PostPosted: Fri May 06, 2011 11:17 am    Post subject: setting MQMD_EXPIRY from XMS application Reply with quote

Novice

Joined: 14 Jan 2011
Posts: 12

We're running into issues where I can't seem to set the MQMD Expiry on my produced messages. It's being set aa MQEI_UNLIMITED according to the logs (basically not getting set) despite my best efforts.

here's the snippets from my simple test program that throws a simple message on a topic and then gets it back and examines the MQMD Expiry property.

Code:

XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
IConnectionFactory connectionFactory = factoryFactory.CreateConnectionFactory();

IConnection connection = connectionFactory.CreateConnection();
ISession session = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);
IDestination topic = session.CreateTopic("TEST");
IMessageConsumer consumer = session.CreateConsumer(topic);

ISession mqSession2 = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);

// I've tried setting the following on both the destination before creating the producer and after creating the producer without any luck

topic.SetBooleanProperty(XMSC.WMQ_MQMD_WRITE_ENABLED, true);
topic.SetIntProperty(XMSC.WMQ_MQMD_MESSAGE_CONTEXT, XMSC.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
topic.SetIntProperty(XMSC.JMS_IBM_MQMD_EXPIRY, 60000);
topic.SetBooleanProperty(XMSC.WMQ_MQMD_READ_ENABLED, true);

IMessageProducer mqProducer = mqSession2.CreateProducer(topic);

mqProducer.SetBooleanProperty(XMSC.WMQ_MQMD_WRITE_ENABLED, true);
mqProducer.SetIntProperty(XMSC.WMQ_MQMD_MESSAGE_CONTEXT, XMSC.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
mqProducer.SetIntProperty(XMSC.JMS_IBM_MQMD_EXPIRY, 60000);
mqProducer.SetBooleanProperty(XMSC.WMQ_MQMD_READ_ENABLED, true);

mqProducer.TimeToLive = 60000;

consumer.MessageListener = new MessageListener(OnMessageReceived);

connection.Start();

IMessage PING_MQ_MESSAGE = mqSession2.CreateMapMessage();
PING_MQ_MESSAGE.JMSExpiration = 60000;
mqProducer.Send(PING_MQ_MESSAGE, PING_MQ_MESSAGE.JMSDeliveryMode, PING_MQ_MESSAGE.JMSPriority, PING_MQ_MESSAGE.JMSExpiration);


void OnMessageReceived(IMessage msg)
{
    try
    {
         IMapMessage mapMsg = (IMapMessage)msg;
         string messageType = (string)msg.GetObjectProperty("messageType");

         Console.WriteLine("received " +  messageType + " msg at " + DateTime.Now);
         Console.WriteLine(msg);
         int value = msg.GetIntProperty(XMSC.JMS_IBM_MQMD_EXPIRY);
         Console.WriteLine("JMS_IBM_MQMD_EXPIRY is " + value);



     }
     catch (Exception ex)
     {
        Console.WriteLine(ex);
     }
 
}



I know that the MQMD_EXPIRY is expressed in tenths-of-second whereas the TimeToLive is in millis, but I'm not getting anything set in the MQMD_EXPIRY field, though the JMSExpiration is getting set to 60000 millis more than the JMSTimestamp as expected.

I'm getting the following output from my OnMessageReceived method:

received pingMQ msg at 5/6/2011 2:01:08 PM

JMSMessage class: jms_map
JMSType:
JMSDeliveryMode: Persistent
JMSExpiration: 1304690519482
JMSPriority: 4
JMSMessageID: ID:414d512045534d515344443220202020fdeeba4ddd7a5321
JMSTimestamp: 1304690459482
JMSCorrelationID: ID:414d512045534d515344443220202020fdeeba4d05129321
JMSDestination: topic://TEST?JMS_IBM_MQMD_Expiry=60000&&mdWriteE
nabled=True&mdReadEnabled=True&mdMessageContext=1
JMSReplyTo:
JMSRedelivered: False
JMS_IBM_Character_Set: 1208
JMS_IBM_Encoding: 546
JMS_IBM_Format: MQSTR
JMS_IBM_MsgType: 8
JMS_IBM_PutApplType: 26
JMS_IBM_PutDate: 5/6/2011
JMS_IBM_PutTime: 19:08:21
JMSXAppID: ESMQSDD2
JMSXDeliveryCount: 1
JMSXUserID: vpmqsdd2

System.NullReferenceException: CWSMQ0200E: The property name JMS_IBM_MQMD_Expiry cannot be set to null. A null value is not valid for the property. Check the property name value is correct.
at IBM.XMS.Client.Impl.XmsReadablePropertyContextImpl.ParseInt32(Object obj,String name)
at IBM.XMS.Client.Impl.XmsMessageImpl.GetIntProperty(String name)
at SampleMQ.Program.OnMessageReceived(IMessage msg) in C:\Users\toweruser\Documents\Visual Studio 2010\Projects\SampleMQ\SampleMQ\Program.cs:line 227

Does anyone have any pointers on what I might be missing?
Back to top
View user's profile Send private message
mvic
PostPosted: Fri May 06, 2011 12:13 pm    Post subject: Re: setting MQMD_EXPIRY from XMS application Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

It could be IZ85603, I suppose.

http://www.ibm.com/support/docview.wss?uid=swg1IZ85603 "DESTINATION PROPERTY XMSC.TIME_TO_LIVE WHICH MAPS TO EXPIRY IS NOT PROCESSING CORRECTLY IN XMS .NET 2.0 TO WMQ V6 QUEUE MANAGER"

Possibly the latest V7 fix pack has the fix, though I can't tell from the web page.
Back to top
View user's profile Send private message
darin.brown
PostPosted: Fri May 06, 2011 12:19 pm    Post subject: Reply with quote

Novice

Joined: 14 Jan 2011
Posts: 12

thanks, I hadn't seen that. though it does sound like there's some code changes that can be made on the XMS side to get around this even if we're using a v6 QM:

XMS .NET client product code is modified to update the message
properties correctly before sending the message.

I just haven't stumbled across the right combination yet..
Back to top
View user's profile Send private message
mvic
PostPosted: Fri May 06, 2011 12:21 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

darin.brown wrote:
XMS .NET client product code is modified to update the message
properties correctly before sending the message.

That's IBM saying the problem is fixed. But it doesn't say how you get the fix - eg. whether it's a fix pack or a re-install of the XMS client etc. You might need to open a PMR to find out. Or maybe put 7.0.1.5 on your client side, as this was recently released, just in case it has the fix.

Are you, in fact, connecting a V7 client to a V6 qmgr? The description seems to apply only if you are connecting to a V6 qmgr.
Back to top
View user's profile Send private message
darin.brown
PostPosted: Fri May 06, 2011 12:35 pm    Post subject: Reply with quote

Novice

Joined: 14 Jan 2011
Posts: 12

yes, our qmgr is v6.0.2.9
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sat May 07, 2011 3:51 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

This page says it's shipped in 7.0.1.4.
http://www-01.ibm.com/support/docview.wss?uid=swg27014224
Back to top
View user's profile Send private message
darin.brown
PostPosted: Thu May 12, 2011 6:14 am    Post subject: Reply with quote

Novice

Joined: 14 Jan 2011
Posts: 12

I grabbed the latest bits for both MQC and XMS and that fixed the problem we were having.

thanks all..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » setting MQMD_EXPIRY from XMS application
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.