VRoxa
VRoxa

Reputation: 1051

IBM MQ Client development environment test

I am about to develop an IBM MQ Client.

I want to start from the very basics, so I created a project to connect to some queue.

public void Init(IbmMqConnection configuration)
{
    // _properties is a Hashtable
    _properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
    _properties.Add(MQC.HOST_NAME_PROPERTY, configuration.Host);
    _properties.Add(MQC.CHANNEL_PROPERTY, configuration.Channel);

    MQEnvironment.Port = 1414;
    MQEnvironment.UserId = configuration.UserId;

    _qm = new MQQueueManager(configuration.QueueManager, _properties);

    int options = 0;
    options += MQC.MQOO_OUTPUT;
    options += MQC.MQOO_INQUIRE;
    options += MQC.MQOO_FAIL_IF_QUIESCING;

    _q = _qm.AccessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE", options);
}

And called this method with the configuration below

_qManager.Init(new IbmMqConnection
{
    Host = "DESA_MQ",
    UserId = "mqscpd",
    Channel = "SCPPAQUE.WIN.SVRCONN",
    QueueManager = "QMDESA01"
});

... and, of course I got this Exception thrown.

MQException -> Completion Code 2 and Reason Code 2298

Well, I wasn't expecting nothing different from that.
I am roaming exhaustively the IBM MQ Documentation and I found nothing related to serve any kind of development environment before installing the real one.

I hope I am missing something to develop my project pointing out to a (free) development server mounted locally or something.

I installed the IBMMQDotnetClient package, version 9.1.5.

Summarying, how can I develop my project testing it before deploy to a real IBM MQ system?
Thanks.

Upvotes: 0

Views: 629

Answers (2)

subbaraoc
subbaraoc

Reputation: 1306

You will have to use Managed mode if you are developing IBM MQ .NET applications using nuget package. To use Managed mode you have to set TRANSPORT_PROPERTY to TRANSPORT_MQSERIES_MANAGED. MQC.TRANSPORT_MQSERIES_CLIENT uses unmanaged mode and is not supported in MQ .NET standard libraries that is the reason you are seeing "MQException -> Completion Code 2 and Reason Code 2298".Modifying the property should do.

    _properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
    _properties.Add(MQC.HOST_NAME_PROPERTY, configuration.Host);
    _properties.Add(MQC.CHANNEL_PROPERTY, configuration.Channel);

With IBM MQ v9.1.5 Client installation, you have project templates which has some basic MQ .NET API's using which you can connect to Queue Manager and then perform a Put/Get operation.Following Knowledge Center link has some information on it:https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q134410_.htm.

As Josh pointed out,LearnMQ is also a good starting point.

Upvotes: 2

lwestby
lwestby

Reputation: 1229

If you have Docker (or another container runtime) available, IBM MQ is available on Dockerhub for development use.

Upvotes: 1

Related Questions