Apache camel 我能知道在使用负载平衡器时最终目标是哪个端点吗?

Apache camel 我能知道在使用负载平衡器时最终目标是哪个端点吗?,apache-camel,Apache Camel,我有一个使用定制负载平衡器的路线 from("timer://myTimer?period=2000") .loadBalance(new MyCustomLoadBalancer()) .to("mock:em1").to("mock:em2").to("mock:em3") .end(); 在定制的平衡器类中,似乎只能获得处理器 public class MyCustomLoadBalancer extends SimpleLoadBalancerSupport { public

我有一个使用定制负载平衡器的路线

from("timer://myTimer?period=2000")
.loadBalance(new MyCustomLoadBalancer())
.to("mock:em1").to("mock:em2").to("mock:em3")
.end();
在定制的平衡器类中,似乎只能获得处理器

public class MyCustomLoadBalancer extends SimpleLoadBalancerSupport {
    public void process(Exchange exchange) throws Exception {
        List<Processor> pList = getProcessors();
        .......

        //It is wanted to log which endpoint is finally targeted.
        foo.process(exchange);            
    }
}
但是处理器不是SendProcessor类(“foo instanceof SendProcessor”返回false),因此我无法通过getDestination获取端点。
我认为端点和处理器之间应该存在某种关系。

你能给我更多的帮助吗?

谢谢。

处理器是SendProcessor,您可以从中获取它将向其发送exchange的端点

if (foo instanceof SendProcessor) {
  SendProcessor send = (SendProcessor) foo;
  Endpoint dest = send.getDestination();
  ...
}

谢谢你的快速回复。我想在真正的Jetty端点上做一些测试。嗨,Ibsen,这可以在负载平衡器中获得所有包含的端点实例吗?我认为负载平衡器Instance就像一个容器。另外,是否可以获取端点实例使用的相应处理器实例?如果这些工作正常,问题也可以解决。与Jetty端点关联的处理器不是SendProcessor的实例;我无法通过您建议的方法获取端点。我希望负载平衡器记录每个端点的状态。因此,用户可以很容易地知道哪个服务有问题。
if (foo instanceof SendProcessor) {
  SendProcessor send = (SendProcessor) foo;
  Endpoint dest = send.getDestination();
  ...
}