I want to connect to the IBM WebSphere MQ without having the IBM MQ Client installed on the client machine. Currently I am able to connect only by installing the MQ Client in the client machine.
Below is the code I used installing MQ Client. I want to communicate without installing MQ Client.
public string ConnectMQ(string strQueueManagerName, string strQueueName,
string strChannelInfo)
{
QueueManagerName = strQueueManagerName;
QueueName = strQueueName;
ChannelInfo = strChannelInfo;
char[] separator = {'/'};
string[] ChannelParams;
ChannelParams = ChannelInfo.Split( separator );
channelName = ChannelParams[0];
transportType = ChannelParams[1];
connectionName = ChannelParams[2];
String strReturn = "";
try
{
queueManager = new MQQueueManager( QueueManagerName,
channelName, connectionName );
strReturn = "Connected Successfully";
}
catch(MQException exp)
{
strReturn = "Exception: " + exp.Message ;
}
return strReturn;
}
String());
msg.setIntProperty("JMSXGroupSeq", 1);
msg.setBooleanProperty("JMS_IBM_Last_Msg_In_Group", true);
msg.setText("Hello World");
connection.start();
producer.send(msg);
producer.close();
session.close();
connection.close();
What I have tried:
public string ConnectMQ(string strQueueManagerName, string strQueueName,
string strChannelInfo)
{
QueueManagerName = strQueueManagerName;
QueueName = strQueueName;
ChannelInfo = strChannelInfo;
char[] separator = {'/'};
string[] ChannelParams;
ChannelParams = ChannelInfo.Split( separator );
channelName = ChannelParams[0];
transportType = ChannelParams[1];
connectionName = ChannelParams[2];
String strReturn = "";
try
{
queueManager = new MQQueueManager( QueueManagerName,
channelName, connectionName );
strReturn = "Connected Successfully";
}
catch(MQException exp)
{
strReturn = "Exception: " + exp.Message ;
}
return strReturn;
}
cf.setStringProperty(CommonConstants.__Fields.WMQ_CHANNEL, "<YOUR INFO>");
cf.setStringProperty(CommonConstants.__Fields.WMQ_QUEUE_MANAGER, "<YOUR INFO>");
var connection = cf.createConnection();
var session = connection.createSession(false, Session.__Fields.AUTO_ACKNOWLEDGE);
var queue = session.createQueue("queue:///<YOUR INFO>");
var producer = session.createProducer(queue);
var msg = session.createTextMessage();
msg.setStringProperty("JMSXGroupID", Guid.NewGuid().ToString());
msg.setIntProperty("JMSXGroupSeq", 1);
msg.setBooleanProperty("JMS_IBM_Last_Msg_In_Group", true);
msg.setText("Hello World");
connection.start();
producer.send(msg);
producer.close();
session.close();
connection.close();