47.4. 使用 BindingComponent
存在一个称为 BindingComponent 的组件,可以在 registry 中通过依赖项注入配置,允许创建已经绑定到某些绑定的端点。
例如,如果您使用代码在 registry 中注册一个名为 "jsonmq" 的新组件,如下所示
JacksonDataFormat format = new JacksonDataFormat(MyBean.class); context.bind("jsonmq", new BindingComponent(new DataFormatBinding(format), "activemq:foo."));
JacksonDataFormat format = new JacksonDataFormat(MyBean.class);
context.bind("jsonmq", new BindingComponent(new DataFormatBinding(format), "activemq:foo."));
然后,您可以使用端点,就像它是任何其他端点一样。
from("jsonmq:myQueue").to("jsonmq:anotherQueue")
from("jsonmq:myQueue").to("jsonmq:anotherQueue")
它使用 queueus "foo.myQueue" 和 "foo.anotherQueue",并使用给定的 Jackson Data Format 来回放和关闭队列。