|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Multi Threaded C# 2018 MQRC_HCONN_ERROR |
« View previous topic :: View next topic » |
Author |
Message
|
pmbsa2 |
Posted: Mon May 09, 2011 1:59 am Post subject: Multi Threaded C# 2018 MQRC_HCONN_ERROR |
|
|
Novice
Joined: 24 Jun 2009 Posts: 21
|
Hi, I was hoping somebody might have encountered something like this. I have a very simple bit of code to bridge SQL Server Service Broker and WMQ, I have a pool of 10 threads running, all seems fine untill I really start ramping up the volume, then I start to get what appear to be thread locks of some form on the connection to the QM. (But I am really not sure)
The connection code looks something like this... (Direct Server Connection).
Hashtable properties = new Hashtable();
properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_BINDINGS);
try
{
queueManager = new MQQueueManager(QueueManagerName, properties);
}
and I have a Finally block that disconnects from the QM after I have put to the Queue
finally
{
// Close anything up if its still open
if (queueManager != null) {
queueManager.Disconnect();
}
}
I am a C# Newb so I am not 100% certain about how the threading is managed, I would appreciate any pointers.
Thanks
Paul |
|
Back to top |
|
 |
mqjeff |
Posted: Mon May 09, 2011 2:26 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you should only connect and disconnect from the qmgr at the start and end of your entire program, not for each operation you want to perform against MQ. |
|
Back to top |
|
 |
pmbsa2 |
Posted: Mon May 09, 2011 3:27 am Post subject: |
|
|
Novice
Joined: 24 Jun 2009 Posts: 21
|
Thanks mqjeff, I managed to answer my own question in the end thankfully.
Turns out that it was because I was creating a static MQQManager object that was was then using across the 2 methods. I simply moved the variable into the main method scope, made it non static and then pass it around between metods to connect and to put to the queue. Sorts the problem out. I now have a very neat little bridge between SQL Service broker and WMQ in case anybody is interested .
thanks
Paul |
|
Back to top |
|
 |
pchak |
Posted: Tue Jul 30, 2013 10:35 am Post subject: |
|
|
Novice
Joined: 19 Oct 2012 Posts: 11
|
Hi Paul,
I thought I'd take you up on your offer. We're just moving into Service Broker, as WMQ is our primary transport between all the different domains, and our mfg environment is SQL Server.
We've been using straight-forward .NET code to read off a queue, and insert via sproc, and then outbound use SQL dependency to get a message and insert on the WMQ queue. I'd be interested in seeing how you integrated with Service Broker.
Cheers!
Bill |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jul 30, 2013 10:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There are WCF bindings possible with MQ, so you could consider using those from Service Broker. |
|
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
|
|
|
|