Detect deletion of a messagequeue?
Posted on 2004-08-31
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
IMSMQQueueInfo3Ptr qi = q->GetQueueInfo();
// Try to refresh the queueinfo
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