簡體   English   中英

MQ/JMS setTargetClient 是否有 MQ/XMS 等效項

[英]Is there an MQ/XMS equivalent for the MQ/JMS setTargetClient

我有一個 XMS 發布應用程序,它正在工作,但它包含 JMS 標頭作為消息的一部分。 我的訂閱應用程序實際上是一個 python 應用程序,我想知道是否可以從 XMS 應用程序中刪除 JMS 標頭。 我知道這在 JMS 中是可能的,但在 C# / XMS 中是否可能。

我的 C# 代碼相當簡單(省略了一些細節 -

            // 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 標頭 -


  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 中的主題目標執行相同的操作

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

是的,你應該能夠做到這一點

嘗試

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

請參閱: https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.ref.dev.doc/prx_wmq_target_client.htm

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM