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 » MQAX200 not Browsing when Amqdnet does.

Post new topic  Reply to topic
 MQAX200 not Browsing when Amqdnet does. « View previous topic :: View next topic » 
Author Message
dunesand
PostPosted: Wed Mar 17, 2004 2:15 am    Post subject: MQAX200 not Browsing when Amqdnet does. Reply with quote

Acolyte

Joined: 17 Nov 2003
Posts: 65
Location: Cambridgeshire, UK

Due to client insistence on something we've just been informed about, I'm having to revert my c# code from using CSD05's .Net interface, to using the ActiveX control.

Just been playing around tring to convert the objects from .Net, to ActiveX (via the interop VS kindly creates for me ) and I came upon a problem.

I first browse a queue, then process the message on it, where process involves possilble manipulating, and posting of data, before going back and then reading the message off the queue, so that if things go to pot half way through a message being processed (eg. some idiot pulls the server plug), my program will just pick up where it left off, not loosing the message in transit.

Worked a treat with the amqdnet.dll, now doesn't work with mqax200.dll...

It doesn't throw the 2033 exception when a message is there, but doesn't retrieve the string from "ReadString" on the message.

Code snippet below (inside a continual while loop):

Code:

    // create the queue
    MQQueue queue = null;
    if ( queue == null )
    {
        queue = (MQQueue) m_QMgr.AccessQueue( m_szQueue,
                 (int)MQ.MQOO_FAIL_IF_QUIESCING + (int)MQ.MQOO_BROWSE,
                    "", "", "" );
    }

    while ( Global.bListening )
    {
        Global.nMessagesInReceive++;

        MQMessage mqMsg = (MQMessage)m_AXsession.AccessMessage();//new MQMessage();
        MQGetMessageOptions mqGetMsgOps = (MQGetMessageOptions)m_AXsession.AccessGetMessageOptions();
        mqGetMsgOps.WaitInterval = m_nPollDelay;
        mqGetMsgOps.Options += (int)MQ.MQGMO_BROWSE_NEXT;

        try
        {
           // Get call appears to correctly fetch a COM object message
           queue.Get( mqMsg, mqGetMsgOps, 0 );
 
           // ReadString is call (i.e.mqMsg is NOT null), but returns null
           string newdata = mqMsg.ReadString( mqMsg.MessageLength );

           if ( newdata != null )
           {
              // we never get here
              if ( newdata != "" )
              {
                   data = newdata;
                   m_szData = data;
       
                   // if all's well, return with data as the new message data
                   Global.nMessagesInReceive--;
                   return eResult.RES_SUCCESS ;
              }
           }
        }
        catch ( Exception ex )
        {
            Global.nMessagesInReceive--;
            //  if ( m_AXsession.ReasonCode == MQ.MQRC_NO_MSG_AVAILABLE )
            {
                 continue;
            }
            m_szExceptionError = ex.Message;
            return eResult.RES_ERROR;
        }
    } // end while


Thanks for your help.
Much appreaciated.
Daniel.


Last edited by dunesand on Wed Mar 17, 2004 3:32 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dunesand
PostPosted: Wed Mar 17, 2004 2:44 am    Post subject: Reply with quote

Acolyte

Joined: 17 Nov 2003
Posts: 65
Location: Cambridgeshire, UK

------ 11:03

it must be the Get (..., ..., 0 ) call.

When reading the documentation I thought this property was optional, and defaulted to zero.

MessageLength is zero, and the ReasonName is "NONE"


----- 11:31

i really don't understand this... put in another value, say 1024 or MaxMessageLength, and still is null on ReadString.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » MQAX200 not Browsing when Amqdnet does.
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.