|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Must Disconnect QManager ? |
« View previous topic :: View next topic » |
Author |
Message
|
nagamalli |
Posted: Mon Aug 09, 2004 7:37 am Post subject: Must Disconnect QManager ? |
|
|
Newbie
Joined: 29 Jul 2004 Posts: 6
|
All,
I am reading messages from one queue, processing and sending back response to another queue. I am using one queueManager for both reading and sending response. When I sent the reponse I am just closing the queue not manager. With this other people can not read the message
When disconnect QManager then they are able to read the response what I sent.
Is it must to close QManager also when you sent message?
I am using C# and 5.3 client
Thanks
Naga |
|
Back to top |
|
 |
vennela |
Posted: Mon Aug 09, 2004 7:49 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Are you using syncpoit?
What are your PUT message options?
Can you post the code snippet?
BTW you are posting messages in the wrong forum. |
|
Back to top |
|
 |
nagamalli |
Posted: Mon Aug 09, 2004 9:01 am Post subject: Here is my code |
|
|
Newbie
Joined: 29 Jul 2004 Posts: 6
|
Thanks for your quick response. Here is my code. Please see if this helps in solving my prob
******** Initialize MQQueueManager *******
private bool InitializeMQ(string queueName,string queueManager)
{
///
/// Try to connect to the queue Manager
///
try
{
mqQMgr = new MQQueueManager( queueManager );
}
catch (MQException mqe)
{
UpdateCBLResponse("InitializeMQ:MQQueueManager","",mqe.Message);
return false;
}
***************Listener******************
if(mql.InitializeMQ(mql.strQueueGet,mql.queueManager))
{
// check for incoming MQ message
bool Done=false;
string xmlMessage=null;
while (!Done && ((xmlMessage=mql.WaitForMessage()) != null))
{
// parse the message
System.Console.WriteLine( "Processing a Message" );
try
{
xmlResponse = mql.CWRequest(xmlMessage);
}
catch (XmlException e)
{
mql.UpdateCBLResponse(xmlMessage,"",e.Message);
Console.WriteLine(e.Message);
}
catch(SoapException e)
{
mql.UpdateCBLResponse(xmlMessage,"",e.Message);
}
catch(InvalidOperationException e)
{
mql.UpdateCBLResponse(xmlMessage,"",e.Message);
}
catch(Exception e)
{
mql.UpdateCBLResponse(xmlMessage,"",e.Message);
}
/* Write returned message to queue */
try
{
mql.MessagePut(xmlResponse);
}
catch(MQException mqe)
{
mql.UpdateCBLResponse(xmlMessage,xmlResponse,mqe.Message);
}
}
}
Console.WriteLine("Credit Check Service Ends" );
***********Put Funcationality *********************
try /* Open Queue for output */
{
mqQueue = mqQMgr.AccessQueue( strQueuePut,
MQC.MQOO_OUTPUT
+ MQC.MQOO_FAIL_IF_QUIESCING+MQC.MQOO_ALTERNATE_USER_AUTHORITY ,queueManager,"",MQUserName); // but not if MQM stopping
//+MQC.MQOO_ALTERNATE_USER_AUTHORITY,null,null,"X42C52"
}
catch (MQException mqe)
{
UpdateCBLResponse("MessagePut:MQQueueManager::AccessQueue",data,mqe.Message);
OutputQValid = false;
}
if (OutputQValid)
{
mqPutOptions = new MQPutMessageOptions();
mqPutOptions.Options = MQC.MQPMO_NONE;
mqMessage = GetMQMessage(data);
}
try
{
//mqQueue.Put(mqMessage,mqPutOptions);
}
catch(MQException mqe)
{
UpdateCBLResponse("MessagePut:MQQueue::PutQueue",data,mqe.Message);
}
finally
{
mqQueue.Close();
} |
|
Back to top |
|
 |
nagamalli |
Posted: Mon Aug 09, 2004 9:04 am Post subject: Addition Info |
|
|
Newbie
Joined: 29 Jul 2004 Posts: 6
|
I am not using any syncpoint. Also I do not know how they defined queue on server.
********** Initialize queue******************
private bool InitializeMQ(string queueName,string queueManager)
{
///
/// Try to connect to the queue Manager
///
try
{
mqQMgr = new MQQueueManager( queueManager );
}
catch (MQException mqe)
{
UpdateCBLResponse("InitializeMQ:MQQueueManager","",mqe.Message);
return false;
}
///
/// Try to open the queue
///
try
{
mqQueue =
mqQMgr.AccessQueue( queueName,
MQC.MQOO_INPUT_AS_Q_DEF // open queue for input
+ MQC.MQOO_FAIL_IF_QUIESCING ); // but not if MQM stopping
}
catch (MQException mqe)
{
UpdateCBLResponse("InitializeMQ:MQQueueManager:AccessQueue","",mqe.Message);
return false;
}
return true;
} |
|
Back to top |
|
 |
WBI_user |
Posted: Mon Aug 09, 2004 8:41 pm Post subject: |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
What was the error code when the other application tried to MQGET the message before you close the Queue and disconnect from the QMGR ? |
|
Back to top |
|
 |
nagamalli |
Posted: Wed Aug 11, 2004 5:03 am Post subject: |
|
|
Newbie
Joined: 29 Jul 2004 Posts: 6
|
MQRC-OBJECT-IN-USE. I tried from another to read those messages. But this problem fixed with Qmanager.Commit method. Please let me know whether this is correct way |
|
Back to top |
|
 |
WBI_user |
Posted: Wed Aug 11, 2004 5:51 am Post subject: |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
The error "Object in use" means that it is being exclusively used by another application or you want exclusive use of the object while other application is still using it .
You have "MQOO_INPUT_AS_Q_DEF " . Please check with your MQ adminstrator to see if the queue is defined for share ( the default attribute) or it is defined for non-share or exclusive. If the queue is defined for share, you should not get the error "Object in use". The fact that it works after you disconnect is because when you disconnect, you give up your exclusive cntrol of the queue. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|