Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » QAnywhere » 连接器 » 从 JMS 连接器向 QAnywhere 客户端发送消息

 

为传递到 QAnywhere 的 JMS 消息指定地址

JMS 客户端向 QAnywhere 客户端发送消息的方法是:将 JMS 消息属性 ias_ToAddress 设置为 QAnywhere 地址,然后将消息发送到与连接器属性 xjms.receiveDestination 对应的 JMS 目标。

请参见QAnywhere 消息地址

示例

例如,向 QAnywhere 地址 "qaddr" 发送消息(其中 xjms.receiveDestination 的连接器设置为 "qanywhere_receive"):

import javax.jms.*;
try {
    QueueSession session;
    QueueSender sender;
    TextMessage mgr;
    Queue connectorQueue; 

    // Initialize the session.
    connectorQueue = session.createQueue("qanywhere_receive");
    sender = session.createSender( connectorQueue );
    msg = session.createTextMessage();
    msg.setStringProperty("ias_ToAddress", "qaddr");

    // Set the message content.
    sender.send(msg);
}
catch( JMSException e ) {
    // Handle the exception.
}

将 JMS 消息映射到 QAnywhere 消息
JMS 属性