⚠️ This project is no longer maintained. Please use the IBMMQDotnetClient.
Our own .Net Core interface for IBM MQ (WebSphere MQ, MQSeries) with Blackjack and Hookers.
NuGet Version | Downloads | Build Status |
---|---|---|
MQI Verb | Implemented | Class |
---|---|---|
MQCONN | ✔️ | MQQueueManager |
MQCONNX | ✔️ | MQQueueManager |
MQDISC | ✔️ | MQQueueManager |
MQOPEN | ✔️ | MQQueue, MQTopic |
MQCLOSE | ✔️ | MQQueue, MQTopic |
MQSUB | ✔️ | MQSubscription |
MQPUT | ✔️ | MQQueue, MQTopic |
MQPUT1 | ✔️ | MQQueueManager |
MQGET | ✔️ | MQQueue |
MQINQ | ❌ | |
MQSET | ❌ | |
MQCMIT | ✔️ | MQQueueManager |
MQBACK | ✔️ | MQQueueManager |
MQCTL | ❌ |
var queueManagerName = "QM01";
var channel = "SVRCONN.1";
var connectionInfo = string.Format("{0}({1})", "192.168.99.100", 1414);
var qmgr = MQQueueManager.Connect(queueManagerName, MQC.MQCO_NONE, channel, connectionInfo);
qmgr.Disconnect();
string message = "Put1InQueue";
var queueManagerName = "QM01";
var channel = "SVRCONN.1";
var connectionInfo = "192.168.99.100(1414)";
using (var qmgr = MQQueueManager.Connect(queueManagerName, MQC.MQCO_NONE, channel, connectionInfo))
{
var outgoing = new MQMessage()
{
CharacterSet = MQC.CODESET_UTF,
Encoding = MQC.MQENC_NORMAL
};
outgoing.WriteString(message);
var od = new MQObjectDescriptor
{
ObjectType = MQC.MQOT_Q,
ObjectName = "QL.QUEUE1"
};
qmgr.Put1(od, outgoing, new MQPutMessageOptions());
}
using (var qmgr = MQQueueManager.Connect(queueManagerName, MQC.MQCO_NONE, channel, connectionInfo))
{
var outgoing = new MQMessage()
{
CharacterSet = MQC.CODESET_UTF,
Encoding = MQC.MQENC_NORMAL
};
outgoing.WriteString(message);
qmgr.Put("QL.QUEUE1", outgoing);
}
using (var qmgr = MQQueueManager.Connect(queueManagerName, MQC.MQCO_NONE, channel, connectionInfo))
using (var q = qmgr.AccessQueue("QL.QUEUE1", MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING))
{
var incoming = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.WaitInterval = (int) TimeSpan.FromSeconds(30).TotalMilliseconds; // or MQC.MQWI_UNLIMITED;
gmo.Options |= MQC.MQGMO_WAIT;
gmo.Options |= MQC.MQGMO_SYNCPOINT;
q.Get(incoming, gmo);
Console.WriteLine(incoming.ReadString(incoming.DataLength));
}
using (var qmgr = MQQueueManager.Connect(queueManagerName, MQC.MQCO_NONE, channel, connectionInfo))
{
var outgoing = new MQMessage()
{
CharacterSet = MQC.CODESET_UTF,
Encoding = MQC.MQENC_NORMAL
};
outgoing.WriteString(message);
var od = new MQObjectDescriptor
{
ObjectType = MQC.MQOT_TOPIC,
ObjectName = string.Empty,
Version = MQC.MQOD_VERSION_4
};
od.ObjectString.VSString = topicName;
qmgr.Put1(od, outgoing, new MQPutMessageOptions());
}
using (var qmgr = MQQueueManager.Connect(queueManagerName, MQC.MQCO_NONE, channel, connectionInfo))
{
var outgoing = new MQMessage()
{
CharacterSet = MQC.CODESET_UTF,
Encoding = MQC.MQENC_NORMAL
};
outgoing.WriteString(message);
qmgr.Publish("Some/Topic", outgoing);
}
using (var qmgr = MQQueueManager.Connect(queueManagerName, MQC.MQCO_NONE, channel, connectionInfo))
{
var subs = new MQSubscription(qmgr);
subs.Subscribe(
"MY.SUBS.NAME",
MQC.MQSO_CREATE + MQC.MQSO_RESUME + MQC.MQSO_NON_DURABLE + MQC.MQSO_MANAGED,
"Some/Topic");
var incoming = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.WaitInterval = (int)TimeSpan.FromSeconds(30).TotalMilliseconds; //MQC.MQWI_UNLIMITED;
gmo.Options |= MQC.MQGMO_WAIT;
gmo.Options |= MQC.MQGMO_SYNCPOINT;
subs.Get(incoming, gmo);
subs.Close(MQC.MQCO_REMOVE_SUB, closeSubQueue: true, closeSubQueueOptions: MQC.MQCO_NONE);
}
Minimalist MQI.Net is licensed under the MIT license.
- As a prerequisite, you first need to install an IBM MQ client in the system where Mmqi.Net is about to be installed; it is a free library offered by IBM on top of which higher-level ones, such as Mmqi.Net, can connect to queue managers. IBM MQ clients can be downloaded from IBM's website. You can dowload the client from here ... IBM MQ V8 Clients