2

I am trying to connect to an existing JMS queue with a .NET client. I know the queue is working, I already browsed it using IBM MQ Explorer.

In the following code, the call to factory.CreateConnection keeps hanging - it does not jump to the next line, in does not show any error message. It even doesnt consume any CPU.

Are there any options that I should try to get it working (or at least make it show me an error message of any kind)?

private static IConnectionFactory GetConnectionFactory()
    {
        var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
        var cf = factoryFactory.CreateConnectionFactory();

        cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "server address");
        cf.SetIntProperty(XMSC.WMQ_PORT, portnumber);
        cf.SetStringProperty(XMSC.WMQ_CHANNEL, "channelname");
        cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
        cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "queuemanager");
        cf.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_UNSPECIFIED);

        return (cf);
    }

The main method has the following:

var factory = GetConnectionFactory();
var connection = factory.CreateConnection("username", null);
Tomas Grosup
  • 6,396
  • 3
  • 30
  • 44
  • What version of XMS and MQ are you using? Have you installed full MQ client ? – Shashi Jun 25 '15 at 08:26
  • I have installed mqc7_7.0.1.12_win (the MQ client) and ia9h_2.0.0.12 (the XMS) – Tomas Grosup Jun 25 '15 at 08:28
  • And the queue itself - the MQ Explorer shows 07010003 in the Version property. Platform Unix, Command level 710. Does this info help you? – Tomas Grosup Jun 25 '15 at 08:29
  • Even better, get a newer MQ client and Queue Manager version. The one you have will be out of support in 3 months. If it is in Production you will want to be able to open a PMR, yes? Also, the .Net classes get better as the product gets newer. Also FYI: a "queue manager" is a container for queues. A queue doesn't have a version number but a queue manager does. I only mention this because an accurate understanding of the component structure tends to yield better code built to use it. – T.Rob Jun 25 '15 at 12:14
  • Thanks. I installed the mqc8_8.0.0.3_win64 mq client, which should be the newest one. No the application does not hang and does not throw any exception, in just kills the process by itself - again on the factory.CreateConnection call. There is no breakpoint in my catch clause being hit, the entire process is shut down. It even writes an event into Windows event log, will append it – Tomas Grosup Jun 25 '15 at 15:02
  • 6/25/2015 17:00:27 - Process(8124.1) User(ga2grc7) Program(sting.vshost.exe) Host(AP579112) Installation(Installation1) VRMF(8.0.0.3) A communications error for occurred. An unexpected error occurred in communications. The return code from the call was 0 (X'0'). Record these values and tell the systems administrator. – Tomas Grosup Jun 25 '15 at 15:02

1 Answers1

2

I don't see any problem with your code, tested it with MQ v8 and works fine. I would suggest you to do:

1) XMS can run in unmanaged mode also. So change

cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);

to

cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED)

and see if that helps.

2) When the call hangs, break into debug and see the call stack to determine the point of hang. It could be waiting on some system event if no CPU is being consumed.

3) Open a PMR with IBM.

Shashi
  • 14,980
  • 2
  • 33
  • 52
  • Wow, changing to unmanaged really helped, thank you. I am now getting a {"MQRC_HOST_NOT_AVAILABLE"} exception, which means failure on the server-side, right? – Tomas Grosup Jun 25 '15 at 12:01
  • Check if you specified correct host and port numbers in your application. If they are correct check if queue manager is running and is listening on that port. – Shashi Jun 25 '15 at 12:41