[ 
https://issues.apache.org/jira/browse/CAMEL-5036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen reassigned CAMEL-5036:
----------------------------------

    Assignee: Claus Ibsen
    
> Camel route with bean element sends on startup invalid message to target 
> route that is represented by a proxy who exposes route
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-5036
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5036
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.2.0
>            Reporter: Stefan Burkard
>            Assignee: Claus Ibsen
>
> I expose a Camel route with a direct endpoint defined in an OSGi bundle with 
> the <camel:proxy> and <osgi:service> tags. The reason for this is to be able 
> to call this direct-route in other routes (defined in other bundles) as a 
> "sub-route" directly as bean [.bean(routeproxy, "method")]. This works as 
> expected.
> But on route startup the toString method is called on the route (for a 
> description) which is propagated to the elements of the route. Therefore my 
> bean-element (which is the direct-route-proxy) receives the toString call and 
> the CamelInvocationHandler converts this toString call to a message and sends 
> it to the direct-route. This more or less empty message is of course not 
> valid for the target route and produces an error on bundle startup.  
> Shouldn't the toString call be suppressed by the proxy, since toString is not 
> part of the Interface the proxy represents? Or is my approach a not 
> recommended or problematic approach?
> Parts of stacktrace to show the way from route startup to the produced message
> => route receives "empty" message
> [omitted]
>       at 
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:45)
>       at 
> org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:65)
>       at $Proxy568.toString(Unknown Source)
>       at sun.reflect.GeneratedMethodAccessor406.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
> => toString call is converted to message and sent to route
> [omitted]
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>       at 
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>       at $Proxy583.toString(Unknown Source)
>       at 
> org.apache.camel.component.bean.ConstantBeanHolder.toString(ConstantBeanHolder.java:48)
> => toString called on bean-element in route (bean is a proxy for a route) 
> [omitted]
>       at java.lang.String.valueOf(String.java:2826)
>       at java.lang.StringBuilder.append(StringBuilder.java:115)
>       at 
> org.apache.camel.impl.EventDrivenConsumerRoute.toString(EventDrivenConsumerRoute.java:46)
>       at 
> org.apache.camel.management.mbean.ManagedRoute.<init>(ManagedRoute.java:41)
>       at 
> org.apache.camel.management.DefaultManagementLifecycleStrategy.onRoutesAdd(DefaultManagementLifecycleStrategy.java:368)
>       at org.apache.camel.impl.RouteService.doStart(RouteService.java:109)
> => Route startup

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to