Solved

Detect deletion of a messagequeue?

Posted on 2004-08-31
2
287 Views
Last Modified: 2011-04-14
Hi everyone!

I have a problem...how can I detect a deleted queue? I tried using the
IMSMQQueueInfo::Refresh() just before sending a message to an queue. If you
do the refresh before sending you´ll get a MQ_ERROR_QUEUE_NOT_FOUND and
you´ll understand that the queue is deleted...the only problem with that is
that the Refresh decreases performance, a lot!

How can I detect a deleted queue, any ideas anyone?


This is my code ( ignore the neverending loop if the queue isn´t found, the
sample is just done to show my thinking ) :

CMessageQueue::PostMessage(IMSMQQueue3Ptr q, CMessage MsgToSend)
{
    // Here I don´t know if the q is deleted or not so I try sending a
message to it
    // and if I get a MQ_ERROR_QUEUE_NOT_FOUND I try to locate it and
    // then try resending the message
    try
    {
         IMSMQQueueInfo3Ptr qi = q->GetQueueInfo();
         // Try to refresh the queueinfo
         qi->Refresh();
         q->Send(MsgToSend);
    }
    catch( _com_error comerr )
    {
        HRESULT hr = comerr.Error();
        if( hr = MQ_ERROR_QUEUE_NOT_FOUND )
        {
            // Try locate the queue and then try this postmessage-function
again
        }
    }
}
0
Comment
Question by:TYB
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 11942466
Actually

         IMSMQQueueInfo3Ptr qi = q->GetQueueInfo();

         if ( !qi) {

             // no IMSMQQueueInfo3Ptr means that queue does not exist
         }

IMHO should do it, no need to refresh...
0
 

Author Comment

by:TYB
ID: 12074093
Tnx for your answer jkr...it helped me out..
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
returning a dereferenced pts in C++ 10 151
Embarcadero C++ Builder XE2 TDateTime 8 72
FMX StringGrid1->Canvas->FillRect Problem 3 153
convert char array to number in c 5 85
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question