0

jmsエンドポイントを作成し、クライアント幅からSpring xmlファイルのcamel:proxyを呼び出すことができます。ここで、Spring/Camelプロキシを使用せずにJMSエンドポイントを直接呼び出すことができるようにしたいと思います。URLで呼びたいです。

これどうやってするの

ありがとうございました

4

2 に答える 2

1

CamelのProducerTemplateAPIを使用して、あらゆる種類のCa​​melエンドポイント/コンポーネントにメッセージを送信できます。

詳細については、http://camel.apache.org/producertemplate.htmlをご覧ください。

于 2013-02-18T17:07:37.273 に答える
1

キャメルキューは、以下を使用して公開できます

public DirectJMSRemotingClient() throws JMSException {
    factory = new ActiveMQConnectionFactory(brokerURL);
    connection = factory.createConnection();
    connection.start();
    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Destination destination = session.createQueue("queueName");
    producer = session.createProducer(destination);
}

public void sendMessage() throws JMSException {

    TextMessage myTextMsg = session.createTextMessage();

    myTextMsg.setText("Hello World");
    System.out.println("Sending Message: " + myTextMsg.getText());
    producer.send(myTextMsg);
}

public static void main(String[] args) throws Exception {
    DirectJMSRemotingClient client = new DirectJMSRemotingClient();
    client.sendMessage();
}    

そしてルートはこのようにラクダで定義することができます

    <route>
        <from uri="jms:queue:queueName" />
        <setExchangePattern pattern="InOut" />
        <to uri="seda:camel-handler" />
    </route>
于 2013-02-19T14:32:09.553 に答える