how to get connect with ibm websphere mq by using c#.net

后端 未结 4 2206
有刺的猬
有刺的猬 2020-12-13 22:07

can any one guide me on, to get connect with ibm websphere mq by using c#.net, reason was i am trying to push the message in to MQ, kindly can any give me suggestion to conn

4条回答
  •  心在旅途
    2020-12-13 22:35

    Already converted (java to c#) mq-client - nuget, github

    c# example:

    var ff = JmsFactoryFactory.getInstance(JmsConstants.__Fields.WMQ_PROVIDER);
    var cf = ff.createConnectionFactory();
    
    cf.setIntProperty(CommonConstants.__Fields.WMQ_CONNECTION_MODE, CommonConstants.__Fields.WMQ_CM_CLIENT);
    cf.setStringProperty(CommonConstants.__Fields.WMQ_HOST_NAME, "127.0.0.1");
    cf.setIntProperty(CommonConstants.__Fields.WMQ_PORT, 8010);
    cf.setStringProperty(CommonConstants.__Fields.WMQ_CHANNEL, "EXAMPLE.CHANNEL.ONE");
    cf.setStringProperty(CommonConstants.__Fields.WMQ_QUEUE_MANAGER, "EXAMPLE_QUEUE_MANAGER");
    cf.setStringProperty(CommonConstants.__Fields.WMQ_APPLICATIONNAME, "JMS EXAMPLE");
    cf.setStringProperty(CommonConstants.USERID, "EXAMPLE_USER");
    
    using (var context = cf.createContext())
    {
        var queue = context.createQueue("queue:///EXAMPLE_QUEUE_NAME");
        var producer = context.createProducer();
        producer.send(queue, "Hello World");
    }
    

提交回复
热议问题