|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Problems reading messages from MQ |
« View previous topic :: View next topic » |
Author |
Message
|
rchiroldes |
Posted: Thu Jun 12, 2008 1:04 pm Post subject: Problems reading messages from MQ |
|
|
Newbie
Joined: 12 Jun 2008 Posts: 2
|
Hi! Dudes,
I have a C# application using AMQMDNET.DLL API for putting messages in remote queues defined in one host/server. My code looks like this:
public override int SendDataToHost(string msg)
{
MQQueueManager mqQMgr; // MQQueueManager instance
MQQueue mqQueue1; // MQQueue instance
MQMessage mqMsg; // MQMessage instance
MQPutMessageOptions mqPutMsgOpts; // MQPutMessageOptions instance
IBM.WMQ.MQEnvironment.Channel = this.mqsconfig.MQSCHANNELNAME;
IBM.WMQ.MQEnvironment.Hostname = this.mqsconfig.MQSCONNECTIONNAME;
IBM.WMQ.MQEnvironment.Port = this.mqsconfig.MQSTCPPORT;
try
{
//mqQMgr = new MQQueueManager(this.mqsconfig.MQSQMANAGER,this.mqsconfig.MQSCHANNELNAME,this.mqsconfig.MQSCONNECTIONNAME);
mqQMgr = new MQQueueManager(this.mqsconfig.MQSQMANAGER,MQC.MQCNO_HANDLE_SHARE_NO_BLOCK,this.mqsconfig.MQSCHANNELNAME,this.mqsconfig.MQSCONNECTIONNAME);
}
catch (MQException mqe)
{
return (mqe.Reason > 0) ? mqe.Reason * -1 : mqe.Reason;
}
if (mqQMgr == null)
return -1;
try
{
mqQueue1 = mqQMgr.AccessQueue(this.mqsconfig.MQSOUTPUTQNAME,
MQC.MQOO_OUTPUT // open queue for output
+ MQC.MQOO_FAIL_IF_QUIESCING ); // but not if MQM stopping
}
catch (MQException mqe)
{
// stop if failed
//MessageBox.Show( "Manager::AccessQueue ended with " + mqe.Message + " MQ ACCESS DENIE Reason Code " + mqe.Reason.ToString());
return (mqe.Reason > 0) ? mqe.Reason * -1 : mqe.Reason;
}
mqMsg = new MQMessage();
mqMsg.WriteString(msg);
mqMsg.Format = MQC.MQFMT_STRING;
mqPutMsgOpts = new MQPutMessageOptions();
mqMsg.Expiry = 600;
try
{
mqQueue1.Put(mqMsg, mqPutMsgOpts );
}
catch (MQException mqe)
{
// report the error
//MessageBox.Show( "MQQueue::Put ended with " + mqe.Message );
return (mqe.Reason > 0) ? mqe.Reason * -1 : mqe.Reason;
//return -2;
}
this.MQSINTERNALKEY = mqMsg.MessageId;
mqQueue1.Close();
return msg.Length;
}
do you know if I'm using the correct way for putting messages??
Thanks
PS: this application is used for multiple clients at the same time and all of them are putting message in the same queue defined in another server.
PSS: in the server where this C# application is running we only have installed the MQ Client. |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Jun 18, 2008 9:56 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
Did you try it? Did it work? If not, what results did you get? What errors, reason codes? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
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
|
|
|
|