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 » MQ Classes for .NET problems

Post new topic  Reply to topic
 MQ Classes for .NET problems « View previous topic :: View next topic » 
Author Message
loslor
PostPosted: Tue Sep 30, 2008 1:06 am    Post subject: MQ Classes for .NET problems Reply with quote

Newbie

Joined: 30 Sep 2008
Posts: 2

Hi,

First I apologize for asking for help in my first message. I've come to this forum in my desperate search for a solution.

I'm developing an application in VB.NET that gets and puts messages in queues. These messages are packed in groups, that is, have the message flags field set to message in group, and the last message of the group has also the last message in group flag activated.

That's what I see in the WebSphere MQ Explorer when I browse one of the given queues. Then I use my app to get the messages. My code is something lile this:

Code:

        Dim qmi As MQQueueManager
        Dim qi As MQQueue
        Dim mi As MQMessage
        Dim getOp As MQGetMessageOptions

        qmi = New MQQueueManager(<QManagerName>)
        qi = qmi.AccessQueue(<QueueName>, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING)
        mi = New MQMessage
        getOp = New MQGetMessageOptions
        qi.Get(mi, getOp)


Which is pretty much the code I've found around in examples. My problem is that when I check the property "MessageFlags" of the message I obtain a 0, and the property "GroupStatus" of the MQGetMessageOptions object has a value of 32, that according to the reference is "Message not in group".

What am I missing? It must be something stupid I've done and I'm not being able to figure out, or that I hope.

Any idea?


Thanks in advance
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Sep 30, 2008 7:19 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

check out your get message options. You may not want to use the default which is what your code is doing....
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
loslor
PostPosted: Tue Sep 30, 2008 10:01 am    Post subject: Reply with quote

Newbie

Joined: 30 Sep 2008
Posts: 2

I've been diving through the options (I guessed it would be there), but the only thing I see I could be missing is the option: "MQC.MQGMO_ALL_MSGS_AVAILABLE". I can't try it now from here but I'll do it first thing in the morning.

Any other clue?


Regards


P.D: thx for the fast answer btw
Back to top
View user's profile Send private message
zlj
PostPosted: Sun Nov 16, 2008 6:03 pm    Post subject: Reply with quote

Apprentice

Joined: 13 Nov 2008
Posts: 32

Hi loslor
I do not very understand what you mead. I used to do this to get message from queue.

1.Get a message queue instance.
Quote:

public static MQQueueManager GetQueueManager(string queueManagerName)
{
MQQueueManager mqMgr = new MQQueueManager(queueManagerName);
return mqMgr;
}

2.Get message queue instance
Code:

 public static MQQueue GetQueue(MQQueueManager mqMgr, string queueName, int openOptions)
        {
            MQQueue queue = mqMgr.AccessQueue(queueName, openOptions);
            return queue;
        }

openOptions=MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING
3.Receive message from queue
Code:

 public static object Receive(MQQueue queue, int WaitInterval)
        {
            MQGetMessageOptions gmo = new MQGetMessageOptions();
            //在同步点控制下获取消息 
        //get message at synchronous point
            gmo.Options = gmo.Options + MQC.MQGMO_SYNCPOINT;
            //如果在队列上没有消息则等待 
        //if no message in queue, waiting!
        gmo.Options = gmo.Options + MQC.MQGMO_WAIT;
            //如果队列管理器停顿则失败   
        //if queue manager QUIESCING then failed.
            gmo.Options = gmo.Options + MQC.MQGMO_FAIL_IF_QUIESCING;

            gmo.WaitInterval = WaitInterval;
            MQMessage outMsg = new MQMessage();
            //outMsg.Format = MQC.MQFMT_STRING;
            queue.Get(outMsg, gmo);
            object message = outMsg.ReadObject();

            return message;
        }


I am chinese, not good at english, sorry.

Regard!
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Nov 16, 2008 6:11 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

What you have in your gmo are syncpoint,wait, fail if quiescing
You need to add msg in group and all msg available...
Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
zlj
PostPosted: Mon Nov 17, 2008 12:46 am    Post subject: Reply with quote

Apprentice

Joined: 13 Nov 2008
Posts: 32

fjb_saper wrote:
What you have in your gmo are syncpoint,wait, fail if quiescing
You need to add msg in group and all msg available...
Have fun

Thank u.
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Nov 17, 2008 3:07 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

You might want to add MQGMO_CONVERT as a good practice.

Use Syncpoint only if you want to allow rollback and can handle backed out messages (and of course use commit at some point).
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 » MQ Classes for .NET problems
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.