简体   繁体   English

Apache Camel-通过路由发送Properties对象

[英]Apache Camel - sending a Properties object over the route

I have a Properties object that contains all the fields to be sent as a message to consumer's queue. 我有一个Properties对象,其中包含要作为消息发送到消费者队列的所有字段。

What is the recommended way to pass Properties-like objects? 推荐的传递类属性对象的方法是什么? Shall I set a header for every key in Properties object or can I just attach the Properties object to the message body (if the former, how is it done?) 我应该为Properties对象中的每个键设置标头,还是可以仅将Properties对象附加到消息主体(如果是前者,如何完成?)

You can use Properties or Headers to pass objects. 您可以使用属性或标题来传递对象。 If you pass the entire Properties objects inside a specific Camel property (As it can carry java objects) or if you actually put each property as a new Camel property is pretty much a matter of taste from your side. 如果您将整个Properties对象传递到特定的Camel属性中(因为它可以携带Java对象),或者实际上将每个属性都当作新的Camel属性放置,则从您的角度来看很像问题。

Or as you say, pass it in the message body, although you might want other things there. 或者,如您所说,将其传递到消息正文中,尽管您可能还需要其他内容。 Think of all those fields as a toolbox. 将所有这些字段视为工具箱。 Use it in the most convenient way. 以最方便的方式使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM