Mark Wimpory created CAMEL-20840:
------------------------------------

             Summary: Cannot cast ResumeActionAwareAdapter to 
KenisisResumeAdapter
                 Key: CAMEL-20840
                 URL: https://issues.apache.org/jira/browse/CAMEL-20840
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2-kinesis
    Affects Versions: 4.6.0
            Reporter: Mark Wimpory


When setting up the KinesisConsumer to use the KinesisResumeAdapter this error 
is thrown.

java.lang.ClassCastException: Cannot cast 
org.apache.camel.support.resume.ResumeActionAwareAdapter to 
org.apache.camel.component.aws2.kinesis.consumer.KinesisResumeAdapter
    at java.base/java.lang.Class.cast(Class.java:3889)
    at org.apache.camel.resume.ResumeStrategy.getAdapter(ResumeStrategy.java:62)

I have isolated this to the following problem.

The KinesisConsumer DOES NOT override the default method in ResumeAware that 
specified the adapter name:
 
default String adapterFactoryService() {
return "adapter-factory";
}
 
This leads to a classpath clash with the camel-support jar that is also use the 
name adapter-factory.  In this case the factory service when called for Kinesis 
creates the wrong type of adapter as above.
 
Other Resumable consumers have renamed their factory files for instance the 
file consumer uses file-adapter-factory.
 
I have created a work around locally (that I dont like) by creating in my own 
classpath a duplicate of the adapter factory.  This is loaded in preference to 
the jar resources but is not a perm fix.
 
The fix required is to: * Change the Kinesis2Consumer to override the method 
above and return its own factory name such as kinesis-adapter-factory
 * Change the build so that the adapter-factory file is replaced with 
kinesis-adapter-factory



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to