...
In Camel 2.3 you can define that proxied methods which has void
as return type, can be treated as Fire and Forget messaging style (aka InOnly). This is done by setting the attribute voidAsInOnly=true
in the <proxy/> tag. If you let it be the default value, which is InOut
then a void method will still wait for the message to be completely routed. This is not always what you want and hence you can use this option to turn it onto a fire and forget style. BTW: You can also add the @InOnly
annotation to the method on the interface to tell Camel that this method is InOnly.
Such an example is shown below:
Wiki Markup |
---|
{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyVoidAsInOnlyTest.xml} |
Proxy from Java
You can also create a proxy from regular Java using a org.apache.camel.component.bean.ProxyHelper
as shown below:
Code Block |
---|
Endpoint endpoint = context.getEndpoint("direct:start"); MyProxySender sender = ProxyHelper.createProxy(endpoint, MyProxySender.class); |
In Camel 2.3 you can use org.apache.camel.builder.ProxyBuilder
which may be easier to use than ProxyHelper:
Wiki Markup |
---|
{snippet:id=e4|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanProxyTest.java} |
Proxy with Annotation
Another way to configure the proxy from java is by using the @Produce annotation. Also see POJO Producing.
...