Camelを使用してActiveMQからメッセージを取り出し、メッセージの内容(protobuf)に基づいて1つまたは複数のメッセージをTwitterに送信します。私はルート内から呼び出され、複数のメッセージを "direct:xyz"エンドポイントに送信するためにインジェクションを使用するBeanを作成しました。Apache Camelエンドポイントインジェクションにより、エンドポイントで利用できるコンシューマはありません
しかし、キャメルはその実行時に不平を言っている:私は代わりに、Bean内からTwitterのエンドポイントに直接注入した場合、それが正常に動作します
2012-11-16 09:56:33,376 | WARN | ication.twitter] | DirectProducer | 160 - org.apache.camel.camel-core - 2.10.2 | No consumers available on endpoint: Endpoint[direct://twitter] to process: Exchange[Message: hello world]
。しかし、テストを簡単にしたり設定を簡素化するために、私は実際のTwitter設定を別にしておきたいので、別のルートに送信したいと思っています。
のようなラクダのコンテキストの設定に見える: - :私は他のルートでは、この問題を持っていた
public class NotificationTweeter {
@EndpointInject(uri = "direct:twitter")
private ProducerTemplate producerTemplate;
public void createTweets(NotificationMsg notification) {
String tweet = notification.getMessageDetail().getTitle();
try {
// only send tweets where the notification message contains the Twitter mechanism
for (MechanismMsg mechanism : notification.getMechanismList()) {
if (mechanism.getType() == MechanismTypeEnum.TWITTER) {
// Cycle round the recipients
for (RecipientMsg recipient : mechanism.getRecipientList()) {
tweet = "@" + recipient.getIdentifier() + " " + tweet;
producerTemplate.sendBody(tweet);
}
// TODO exceptions if no recipients found, etc
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
(それは確かにTwitterの機能に関連していない - 豆がどのように見える
)しかし、ちょうどそれを回避した。今回は、実際に問題点を理解したいと思います!感謝していただきました、ありがとうございました。
ありがとうございました。私はstartupOrder = "100"を直接ルートに追加し、 "200"を送信して完全に動作させました。 –
ルートを設定する前に、プロデューサテンプレートと開始カメルコンテキストを設定していました。オーダーはconfigure route - camel context start - Producer Template configuration –