简体   繁体   English

如何使用setter在Apache Camel中将属性设置为端点?

[英]How to Set properties to endpoint in Apache Camel using setters?

I want to set some properties to the Endpoint as below. 我想将一些属性设置为Endpoint,如下所示。

from().to().setProperty(timeout,constant(12)); 从()到()的setProperty(超时,常数(12))。。

Using setProperty as above, it is setting property to the exchange/message object ? 如上所述使用setProperty,它是否为交换/消息对象设置属性? How to retrieve this property in the endpoint itself or How to set it for endpoint (not by passing it in the URI ) ? 如何在端点本身中检索此属性或如何为端点设置它(不是通过在URI中传递它)?

I know that we can pass this to the endpoint URI. 我知道我们可以将它传递给端点URI。 But just want to know if there is a way to do with help of setters. 但只是想知道是否有办法帮助安装者。

If you want to set properties to your from-endpoint you can do that like the following: 如果要将属性设置为from-endpoint,可以执行以下操作:

CxfEndpoint endpoint = (CxfEndpoint) new CxfComponent(this.getContext()).createEndpoint(<uri>);
endpoint.setxxx // here you can configure your endpoint with setters

from(endpoint)...

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

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