ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Multi Threaded C# 2018 MQRC_HCONN_ERROR

Post new topic  Reply to topic
 Multi Threaded C# 2018 MQRC_HCONN_ERROR « View previous topic :: View next topic » 
Author Message
pmbsa2
PostPosted: Mon May 09, 2011 1:59 am    Post subject: Multi Threaded C# 2018 MQRC_HCONN_ERROR Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Mon May 09, 2011 2:26 am    Post subject: Reply with quote

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
View user's profile Send private message
pmbsa2
PostPosted: Mon May 09, 2011 3:27 am    Post subject: Reply with quote

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
View user's profile Send private message
pchak
PostPosted: Tue Jul 30, 2013 10:35 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Tue Jul 30, 2013 10:48 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Multi Threaded C# 2018 MQRC_HCONN_ERROR
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.