camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apara <ap...@standardset.com>
Subject AmbiguousMethodCallException but both methods are the same!
Date Thu, 30 Apr 2015 08:18:53 GMT
I have a route that looks like this:

        <camel:route>
            <camel:from uri="direct://handle.event" />

            <camel:to
uri="log:com.mediaplatform.CAMEL-IN-beforeEventLogger?level=DEBUG&amp;showAll=true&amp;multiline=true"
/>

            <camel:to uri="direct://eventDataLogger"/>

            <camel:to
uri="log:com.mediaplatform.CAMEL-IN-beforeDuplicateEventChecker?level=DEBUG&amp;showAll=true&amp;multiline=true"
/>

            <camel:to uri="direct://duplicateEventChecker" />

            <camel:to
uri="log:com.mediaplatform.CAMEL-IN-beforeDateTransform?level=DEBUG&amp;showAll=true&amp;multiline=true"
/>


            <camel:to uri="direct://dateTransformation"/>
            <camel:to uri="direct://userAgentParser" />
            <camel:to uri="direct://pageToIdEventAssociation"/>
            <camel:to uri="direct://bufferedEventInsertAugmentation"/>
            <camel:to uri="direct://playerStartUpEventAugmentation"/>
            <camel:to uri="direct://loadStartToPreviousLoadstartAssociation"
/>
            <camel:to uri="direct://insertPlaySuccessAfterTimeupdate" />
            <camel:to
uri="direct://bufferedEventToPreviousLoadStartAssociation" />
            <camel:to uri="direct://mongoDBPersistence"/>
        </camel:route>

All the endpoints are proxies to spring bean.  All proxies implement the
same interface:

public interface Handler {
    Future<EventData> asyncHandle(EventData data) throws HandlerException;
    EventData syncHandle(EventData data) throws HandlerException;
}


When the route is invoked with syncHandle method, everything works fine. 
However, when I invoke the route with asyncHandle() I see that at first, the
bodyType in the exchange if of type:

org.apache.camel.component.bean.BeanInvocation

2015-04-30 01:05:31,396 kinesis-consumer DEBUG [Camel
(handler-b7cd7848-9cc8-11e4-89d3-123b93f75cba) thread #8 -
CamelInvocationHandler] com.mediaplatform.CAMEL-IN-beforeEventLogger
[CamelLogger.java:170] Exchange[
, Id: ID-apara-i-standardset-com-65381-1430381111386-0-12
, ExchangePattern: InOut
, Properties: {CamelCreatedTimestamp=Thu Apr 30 01:05:31 PDT 2015,
CamelMessageHistory=[DefaultMessageHistory[routeId=route2, node=to2]],
CamelToEndpoint=log://com.mediaplatform.CAMEL-IN-beforeEventLogger?level=DEBUG&multiline=true&showAll=true}
, Headers:
{breadcrumbId=ID-apara-i-standardset-com-65381-1430381111386-0-10}
, BodyType: org.apache.camel.component.bean.BeanInvocation
, Body: BeanInvocation public abstract java.util.concurrent.Future
com.mediaplatform.cdc.consumer.process.handler.Handler.asyncHandle(com.mediaplatform.cdc.event.EventData)
throws
com.mediaplatform.cdc.consumer.process.handler.exception.HandlerException
with [EventDataImpl{id='null', partitionKey='constant',
vd=VariableDataImpl{} {T=pl, ts=2015-04-29T15:56:07.463Z, ua=Mozilla/5.0
(Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/41.0.2272.104 Safari/537.36,
eid=82da185c-7a55-49a3-9eb6-948fac23d0ee, av=5.0 (Macintosh; Intel Mac OS X
10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104
Safari/537.36}}]]
, Out: null: 
]

So, the first end-point is invoked correctly.  However, after the first
endpoint, the body type becomes:

java.util.concurrent.FutureTask

2015-04-30 01:05:31,408 kinesis-consumer DEBUG [Camel
(handler-b7cd7848-9cc8-11e4-89d3-123b93f75cba) thread #8 -
CamelInvocationHandler]
com.mediaplatform.CAMEL-IN-beforeDuplicateEventChecker
[CamelLogger.java:170] Exchange[
, Id: ID-apara-i-standardset-com-65381-1430381111386-0-12
, ExchangePattern: InOut
, Properties: {CamelCreatedTimestamp=Thu Apr 30 01:05:31 PDT 2015,
CamelMessageHistory=[DefaultMessageHistory[routeId=route2, node=to2],
DefaultMessageHistory[routeId=route2, node=to3],
DefaultMessageHistory[routeId=route2, node=to4]],
CamelToEndpoint=log://com.mediaplatform.CAMEL-IN-beforeDuplicateEventChecker?level=DEBUG&multiline=true&showAll=true}
, Headers:
{breadcrumbId=ID-apara-i-standardset-com-65381-1430381111386-0-10}
, BodyType: java.util.concurrent.FutureTask
, Body: java.util.concurrent.FutureTask@27a9fba8
, Out: null: 
]

The next route is "fuzzy" matched via chooseBestPossibleMethodInfo, because
we lost the bean invocation (which was exact).  During the fuzzy match, I
get the following exception because somehow camel finds two functions which
are the SAME to qualify:

org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
method invocations possible: [public final
com.mediaplatform.cdc.event.EventData
com.sun.proxy.$Proxy93.syncHandle(com.mediaplatform.cdc.event.EventData)
throws
com.mediaplatform.cdc.consumer.process.handler.exception.HandlerException,
public final com.mediaplatform.cdc.event.EventData
com.sun.proxy.$Proxy93.syncHandle(com.mediaplatform.cdc.event.EventData)
throws
com.mediaplatform.cdc.consumer.process.handler.exception.HandlerException].
Exchange[Message: EventDataImpl{id='null', partitionKey='constant',
vd=VariableDataImpl{} {T=qos, ts=2015-04-29T15:56:07.463Z,
plid=3730a0cd-3a19-41b0-be4a-dd5463e11254,
eid=262f74f5-1ccc-4de6-96dc-0ed5c3191500, TT=timeupdate}}]
	at
org.apache.camel.component.bean.BeanInfo.chooseBestPossibleMethodInfo(BeanInfo.java:779)
~[camel-core-2.15.1.jar:2.15.1]

Both methods are EXACTLY the same:

public final com.mediaplatform.cdc.event.EventData
com.sun.proxy.$Proxy93.syncHandle(com.mediaplatform.cdc.event.EventData)
throws
com.mediaplatform.cdc.consumer.process.handler.exception.HandlerException
 
public final com.mediaplatform.cdc.event.EventData
com.sun.proxy.$Proxy93.syncHandle(com.mediaplatform.cdc.event.EventData)
throws
com.mediaplatform.cdc.consumer.process.handler.exception.HandlerException

So, I am not sure where to go from here.  Again, this works perfectly fine
when syncHandle is executed, but breaks with this exception when asyncHandle
is executed.

Thanks.
-AP_






--
View this message in context: http://camel.465427.n5.nabble.com/AmbiguousMethodCallException-but-both-methods-are-the-same-tp5766545.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message