Example for adding TCP (Netty) encoder/decoders (registry?)
dhartford Dec 31, 2013 10:20 AMHi all,
Using Switchyard 1.1, it is unclear how to add custom encoders/decoders and have it usable with the Netty binding in Switchyard.
Creating a new Switchyard project (updating to 1.1.0.Final), I've added the beans defined here into the Switchyard precreated META-INF/beans.xml file:
(adding xmlns:util="http://www.springframework.org/schema/util" for the util list in beans.xml)
then I add the reference to the switchyard xml binding (note sync=true for request/reply):
<sca:service name="route" promote="Route/route">
<sy:interface.esb inputType="java:java.lang.String"/>
<netty:binding.tcp name="tcp6000">
<netty:host>0.0.0.0</netty:host>
<netty:port>6000</netty:port>
<netty:allowDefaultCodec>false</netty:allowDefaultCodec>
<netty:sync>true</netty:sync>
<netty:decoders>#length-decoder</netty:decoders>
</netty:binding.tcp>
</sca:service>
But I get the following errors (abbreviated):
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: netty://tcp://0.0.0.0:6000?allow
DefaultCodec=false&decoders=%23length-decoder&sync=true due to: No bean could be found in the registry for: length-deco
der of type: java.lang.Object
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:469)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:50)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:186)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:107)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:113)
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:89)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:851)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:171)
... 17 more
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: length-decoder of type: jav
a.lang.Object
Note: The end goal is to evaluate Switchyard using a request/reply exchange usecase from a TCP payload to an HTTP reference and back, so if someone already has an example or known gotcha's for this usecase, please share :-)
Thanks in advance for any feedback!
-D