1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| using System;
using System.Collections.Generic;
using System.Text;
using IBM.WMQ;
namespace RemoteMQTest {
class Test01 {
static void Main(string[] args) {
MQEnvironment.Hostname = "My_Server";
MQEnvironment.Channel = "My_Channel";
string mqQueueManagerName = "My_Q_Manager";
string mqQueueName = "My_Queue";
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF;
MQQueueManager qMgr = new MQQueueManager(mqQueueManagerName);
MQQueue q = qMgr.AccessQueue(mqQueueName, openOptions);
MQMessage message = new MQMessage();
message.Version = 2;
q.Get(message);
Console.WriteLine("I got the message : {0}", message.ReadString(message.DataLength));
message.Seek(0);
q.Close();
qMgr.Close();
Console.WriteLine("done!");
}
}
}
|