Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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();
Posted
Updated 15-Nov-17 23:44pm
v2
Comments
Mehdi Gholam 16-Nov-17 5:25am    
The drivers are there for a reason, so you don't have to write the connecting code.
Richard MacCutchan 16-Nov-17 6:11am    
You could try asking IBM.
ranio 16-Nov-17 7:33am    
Is it possible to communicate (send/receive) message without installing MQ Client?
Dave Kreskowiak 16-Nov-17 9:39am    
Ask IBM. You're going to have to write all of the communication code that's contained in the driver you don't want to use.

I'd say, sure, you can, but why would you put yourself through all that pain?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900