MQ/JMS setTargetClient是否有等效的MQ/XMS [英] Is there an MQ/XMS equivalent for the MQ/JMS setTargetClient

查看:392
本文介绍了MQ/JMS setTargetClient是否有等效的MQ/XMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在运行的XMS发布应用程序,但是它包含JMS标头作为消息的一部分.我的订阅应用程序实际上是一个python应用程序,我想知道是否有可能从XMS应用程序中删除JMS标头.我知道在JMS中是可能的,但是在C#/XMS中是可能的.

I have a XMS publish app, that is working, but it is including JMS headers as part of the message. My subscribe app is actually a python app, and I was wondering if it is possible to remove the JMS headers from the XMS app. I know it is possible in JMS, but is it possible in C# / XMS.

我的C#代码非常简单(有些细节被遗漏了-

My C# code is fairly simple (with some of the details left out -

            // Get an instance of factory.
            factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);

            // Create WMQ Connection Factory.
            cf = factoryFactory.CreateConnectionFactory();

            // Set the properties
            cf.SetStringProperty(XMSC.WMQ_HOST_NAME, conn.host);
            ...

            // Create connection.
            connectionWMQ = cf.CreateConnection();

            // Create session
            sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge);

            // Create destination
            destination = sessionWMQ.CreateTopic(conn.topic_name);

            // Create producer
            producer = sessionWMQ.CreateProducer(destination);

            // Start the connection to receive messages.
            connectionWMQ.Start();

            // Create a text message and send it.
            textMessage = sessionWMQ.CreateTextMessage();
            textMessage.Text = xmsJson.toJsonString();
            producer.Send(textMessage);

在MQ/JMS中,我可以使用setTargetClient删除JMS标头-

In MQ /JMS I can use setTargetClient to remove the JMS headers -


  private void setToNoJMSHeaders(Destination destination) {
    try {
        MQDestination mqDestination = (MQDestination) destination;
        mqDestination.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);
    } catch (JMSException jmsex) {
      logger.warning("Unable to set target destination to non JMS");
    }
  }

我想知道是否可以对XMS中的主题目标执行相同的操作

I was wondering if I can do the same to the topic destination in XMS

            // Create destination
            destination = sessionWMQ.CreateTopic(conn.topic_name);
            // Configure the destination to Non-JMS
            ... ???

推荐答案

是的,您应该可以这样做

Yes, you should be able to do this

尝试

// Create destination
       destination = sessionWMQ.CreateTopic(conn.topic_name);
       destination.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, XMSC.WMQ_TARGET_DEST_MQ);

请参阅: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆