如果端点之一停止连接,Apache Camel 的负载平衡路由将不起作用
Apache Camel's load balanced route doesn't work if one of the endpoint stops connecting
我有一个场景,如果我的端点 1 出现故障,所有消息都应该路由到端点 2,反之亦然。如果两者都已启动,则应以循环方式发送消息。有人可以告诉我如何处理这种情况吗?
from(itemFileConfig.getWorkingDir())
.log("Entered into file consumption part::")
.autoStartup(true)
.process(fileProcessor)
.split(body().tokenize("\n"))
.loadBalance()
.roundRobin()
.to("direct:kafkaPosting1", "direct:kafkaPosting2")
.end();
from("direct:kafkaPosting1")
.to("kafka:" + config.getTopicName() + "?" + "brokers=" +
config.getBoostStapServers1() + "&" +"serializerClass=" +
config.getSerializer())
.end();
from("direct:kafkaPosting2")
.to("kafka:" + config.getTopicName() + "?" + "brokers=" +
config.getBoostStapServers2() + "&" +"serializerClass=" +
config.getSerializer())
.end();
提前致谢
// use load balancer with failover strategy
// 1 = which will try 1 failover attempt before exhausting
// false = do not use Camel error handling
// true = use round robin mode
.loadBalance().failover(1, false, true)
.to("direct:kafkaPosting1").to("direct:kafkaPosting2");
我有一个场景,如果我的端点 1 出现故障,所有消息都应该路由到端点 2,反之亦然。如果两者都已启动,则应以循环方式发送消息。有人可以告诉我如何处理这种情况吗?
from(itemFileConfig.getWorkingDir())
.log("Entered into file consumption part::")
.autoStartup(true)
.process(fileProcessor)
.split(body().tokenize("\n"))
.loadBalance()
.roundRobin()
.to("direct:kafkaPosting1", "direct:kafkaPosting2")
.end();
from("direct:kafkaPosting1")
.to("kafka:" + config.getTopicName() + "?" + "brokers=" +
config.getBoostStapServers1() + "&" +"serializerClass=" +
config.getSerializer())
.end();
from("direct:kafkaPosting2")
.to("kafka:" + config.getTopicName() + "?" + "brokers=" +
config.getBoostStapServers2() + "&" +"serializerClass=" +
config.getSerializer())
.end();
提前致谢
// use load balancer with failover strategy
// 1 = which will try 1 failover attempt before exhausting
// false = do not use Camel error handling
// true = use round robin mode
.loadBalance().failover(1, false, true)
.to("direct:kafkaPosting1").to("direct:kafkaPosting2");