jmsエンドポイントを作成し、クライアント幅からSpring xmlファイルのcamel:proxyを呼び出すことができます。ここで、Spring/Camelプロキシを使用せずにJMSエンドポイントを直接呼び出すことができるようにしたいと思います。URLで呼びたいです。
これどうやってするの
ありがとうございました
jmsエンドポイントを作成し、クライアント幅からSpring xmlファイルのcamel:proxyを呼び出すことができます。ここで、Spring/Camelプロキシを使用せずにJMSエンドポイントを直接呼び出すことができるようにしたいと思います。URLで呼びたいです。
これどうやってするの
ありがとうございました
CamelのProducerTemplateAPIを使用して、あらゆる種類のCamelエンドポイント/コンポーネントにメッセージを送信できます。
詳細については、http://camel.apache.org/producertemplate.htmlをご覧ください。
キャメルキューは、以下を使用して公開できます
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>