You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/07/27 10:45:56 UTC

[camel] branch main updated: CAMEL-18152: implement auto-configuration for the adapters

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new c312727f720 CAMEL-18152: implement auto-configuration for the adapters
c312727f720 is described below

commit c312727f720c38dd6cead5619a5bc84173338333
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jul 26 16:09:39 2022 +0200

    CAMEL-18152: implement auto-configuration for the adapters
---
 .../services/org/apache/camel/adapter-factory         |  2 ++
 .../services/org/apache/camel/atom-adapter-factory    |  2 ++
 .../camel/component/atom/UpdatedDateFilter.java       |  3 +++
 .../component/feed/FeedEntryPollingConsumer.java      |  5 +++++
 .../main/resources/org/apache/camel/resume/Adapter    | 18 ------------------
 .../services/org/apache/camel/adapter-factory         |  2 ++
 .../kinesis/consumer/KinesisDefaultResumeAdapter.java |  3 +++
 .../main/resources/org/apache/camel/resume/Adapter    | 18 ------------------
 .../main/resources/org/apache/camel/resume/Adapter    | 19 -------------------
 .../main/resources/org/apache/camel/resume/Adapter    | 19 -------------------
 .../main/resources/org/apache/camel/resume/Adapter    | 18 ------------------
 .../services/org/apache/camel/file-adapter-factory    |  2 ++
 .../org/apache/camel/component/file/FileConsumer.java |  4 ++++
 .../consumer/adapters/FileResumeAdapterDelegate.java  |  2 ++
 .../main/resources/org/apache/camel/resume/Adapter    | 18 ------------------
 .../apache/camel/component/master/MasterConsumer.java |  9 ++++++++-
 .../java/org/apache/camel/resume/ResumeAdapter.java   |  1 +
 .../java/org/apache/camel/resume/ResumeAware.java     | 13 +++++++++++++
 .../org/apache/camel/impl/engine/DefaultRoute.java    |  2 +-
 .../services/org/apache/camel/adapter-factory         |  2 ++
 .../apache/camel/support/resume/AdapterHelper.java    | 14 +++++++-------
 .../support/resume/ResumeActionAwareAdapter.java      |  3 +++
 22 files changed, 60 insertions(+), 119 deletions(-)

diff --git a/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory b/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory
new file mode 100644
index 00000000000..f71a880bc41
--- /dev/null
+++ b/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.atom.UpdatedDateFilter
diff --git a/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/atom-adapter-factory b/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/atom-adapter-factory
new file mode 100644
index 00000000000..f71a880bc41
--- /dev/null
+++ b/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/atom-adapter-factory
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.atom.UpdatedDateFilter
diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java
index c8d8dce7840..d89ed30366f 100644
--- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java
+++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java
@@ -20,6 +20,8 @@ import java.util.Date;
 
 import org.apache.abdera.model.Entry;
 import org.apache.camel.component.feed.EntryFilter;
+import org.apache.camel.resume.ResumeAdapter;
+import org.apache.camel.spi.annotations.JdkService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -27,6 +29,7 @@ import org.slf4j.LoggerFactory;
  * Filters out all entries which occur before the last time of the entry we saw (assuming entries arrive sorted in
  * order).
  */
+@JdkService(ResumeAdapter.RESUME_ADAPTER_FACTORY)
 public class UpdatedDateFilter implements EntryFilter<Entry> {
 
     private static final Logger LOG = LoggerFactory.getLogger(UpdatedDateFilter.class);
diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java b/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java
index 035e7ea4f15..0f33cc36fcd 100644
--- a/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java
+++ b/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java
@@ -88,6 +88,11 @@ public abstract class FeedEntryPollingConsumer<E> extends FeedPollingConsumer im
         return resumeStrategy;
     }
 
+    @Override
+    public String adapterFactoryService() {
+        return "atom-adapter-factory";
+    }
+
     protected abstract void resetList();
 
     protected abstract void populateList(Object feed) throws Exception;
diff --git a/components/camel-atom/src/main/resources/org/apache/camel/resume/Adapter b/components/camel-atom/src/main/resources/org/apache/camel/resume/Adapter
deleted file mode 100644
index c32e5e5ab78..00000000000
--- a/components/camel-atom/src/main/resources/org/apache/camel/resume/Adapter
+++ /dev/null
@@ -1,18 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-class=org.apache.camel.component.atom.UpdatedDateFilter
diff --git a/components/camel-aws/camel-aws2-kinesis/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory b/components/camel-aws/camel-aws2-kinesis/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory
new file mode 100644
index 00000000000..0e7c6193aee
--- /dev/null
+++ b/components/camel-aws/camel-aws2-kinesis/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.aws2.kinesis.consumer.KinesisDefaultResumeAdapter
diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/consumer/KinesisDefaultResumeAdapter.java b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/consumer/KinesisDefaultResumeAdapter.java
index 2e57fd1ca7c..72172ef4bd5 100644
--- a/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/consumer/KinesisDefaultResumeAdapter.java
+++ b/components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/consumer/KinesisDefaultResumeAdapter.java
@@ -23,12 +23,15 @@ import org.apache.camel.resume.Cacheable;
 import org.apache.camel.resume.Deserializable;
 import org.apache.camel.resume.Offset;
 import org.apache.camel.resume.OffsetKey;
+import org.apache.camel.resume.ResumeAdapter;
 import org.apache.camel.resume.cache.ResumeCache;
+import org.apache.camel.spi.annotations.JdkService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import software.amazon.awssdk.services.kinesis.model.GetShardIteratorRequest;
 import software.amazon.awssdk.services.kinesis.model.ShardIteratorType;
 
+@JdkService(ResumeAdapter.RESUME_ADAPTER_FACTORY)
 public class KinesisDefaultResumeAdapter implements KinesisResumeAdapter, Cacheable, Deserializable {
     private static final Logger LOG = LoggerFactory.getLogger(KinesisDefaultResumeAdapter.class);
 
diff --git a/components/camel-aws/camel-aws2-kinesis/src/main/resources/org/apache/camel/resume/Adapter b/components/camel-aws/camel-aws2-kinesis/src/main/resources/org/apache/camel/resume/Adapter
deleted file mode 100644
index f39c417887c..00000000000
--- a/components/camel-aws/camel-aws2-kinesis/src/main/resources/org/apache/camel/resume/Adapter
+++ /dev/null
@@ -1,18 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-class=org.apache.camel.component.aws2.kinesis.consumer.KinesisDefaultResumeAdapter
diff --git a/components/camel-cassandraql/src/main/resources/org/apache/camel/resume/Adapter b/components/camel-cassandraql/src/main/resources/org/apache/camel/resume/Adapter
deleted file mode 100644
index ca5a3ee17dc..00000000000
--- a/components/camel-cassandraql/src/main/resources/org/apache/camel/resume/Adapter
+++ /dev/null
@@ -1,19 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-
-class=org.apache.camel.support.resume.ResumeActionAwareAdapter
diff --git a/components/camel-couchbase/src/main/resources/org/apache/camel/resume/Adapter b/components/camel-couchbase/src/main/resources/org/apache/camel/resume/Adapter
deleted file mode 100644
index ca5a3ee17dc..00000000000
--- a/components/camel-couchbase/src/main/resources/org/apache/camel/resume/Adapter
+++ /dev/null
@@ -1,19 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-
-class=org.apache.camel.support.resume.ResumeActionAwareAdapter
diff --git a/components/camel-couchdb/src/main/resources/org/apache/camel/resume/Adapter b/components/camel-couchdb/src/main/resources/org/apache/camel/resume/Adapter
deleted file mode 100644
index 9bf147a072d..00000000000
--- a/components/camel-couchdb/src/main/resources/org/apache/camel/resume/Adapter
+++ /dev/null
@@ -1,18 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-class=org.apache.camel.support.resume.ResumeActionAwareAdapter
diff --git a/components/camel-file/src/generated/resources/META-INF/services/org/apache/camel/file-adapter-factory b/components/camel-file/src/generated/resources/META-INF/services/org/apache/camel/file-adapter-factory
new file mode 100644
index 00000000000..f741095c5aa
--- /dev/null
+++ b/components/camel-file/src/generated/resources/META-INF/services/org/apache/camel/file-adapter-factory
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.file.consumer.adapters.FileResumeAdapterDelegate
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/FileConsumer.java b/components/camel-file/src/main/java/org/apache/camel/component/file/FileConsumer.java
index 4b1b8f4db38..6aeec6a7323 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/FileConsumer.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/FileConsumer.java
@@ -340,4 +340,8 @@ public class FileConsumer extends GenericFileConsumer<File> implements ResumeAwa
         this.resumeStrategy = resumeStrategy;
     }
 
+    @Override
+    public String adapterFactoryService() {
+        return "file-adapter-factory";
+    }
 }
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/consumer/adapters/FileResumeAdapterDelegate.java b/components/camel-file/src/main/java/org/apache/camel/component/file/consumer/adapters/FileResumeAdapterDelegate.java
index f666cb1cff0..f00229329f6 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/consumer/adapters/FileResumeAdapterDelegate.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/consumer/adapters/FileResumeAdapterDelegate.java
@@ -29,7 +29,9 @@ import org.apache.camel.resume.Deserializable;
 import org.apache.camel.resume.Offset;
 import org.apache.camel.resume.OffsetKey;
 import org.apache.camel.resume.cache.ResumeCache;
+import org.apache.camel.spi.annotations.JdkService;
 
+@JdkService("file-adapter-factory")
 public class FileResumeAdapterDelegate
         implements FileResumeAdapter, Cacheable, Deserializable, FileOffsetResumeAdapter, DirectoryEntriesResumeAdapter {
     private final DefaultDirectoryEntriesResumeAdapter directoryEntriesResumeAdapter
diff --git a/components/camel-file/src/main/resources/org/apache/camel/resume/Adapter b/components/camel-file/src/main/resources/org/apache/camel/resume/Adapter
deleted file mode 100644
index fbdc0e532f2..00000000000
--- a/components/camel-file/src/main/resources/org/apache/camel/resume/Adapter
+++ /dev/null
@@ -1,18 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-class=org.apache.camel.component.file.consumer.adapters.FileResumeAdapterDelegate
diff --git a/components/camel-master/src/main/java/org/apache/camel/component/master/MasterConsumer.java b/components/camel-master/src/main/java/org/apache/camel/component/master/MasterConsumer.java
index 2e699a2de92..3db4b7c6980 100644
--- a/components/camel-master/src/main/java/org/apache/camel/component/master/MasterConsumer.java
+++ b/components/camel-master/src/main/java/org/apache/camel/component/master/MasterConsumer.java
@@ -29,9 +29,11 @@ import org.apache.camel.cluster.CamelClusterEventListener;
 import org.apache.camel.cluster.CamelClusterMember;
 import org.apache.camel.cluster.CamelClusterService;
 import org.apache.camel.cluster.CamelClusterView;
+import org.apache.camel.resume.ResumeAdapter;
 import org.apache.camel.resume.ResumeAware;
 import org.apache.camel.resume.ResumeStrategy;
 import org.apache.camel.support.DefaultConsumer;
+import org.apache.camel.support.resume.AdapterHelper;
 import org.apache.camel.support.service.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -139,8 +141,13 @@ public class MasterConsumer extends DefaultConsumer implements ResumeAware {
         }
 
         if (delegatedConsumer instanceof ResumeAware) {
+            final ResumeAware resumeAwareConsumer = (ResumeAware) delegatedConsumer;
+            LOG.info("Setting up the resume adapter for the resume strategy in the delegated consumer");
+            ResumeAdapter resumeAdapter = AdapterHelper.eval(clusterService.getCamelContext(), resumeAwareConsumer);
+            resumeStrategy.setAdapter(resumeAdapter);
+
             LOG.info("Setting up the resume strategy for the delegated consumer");
-            ((ResumeAware) delegatedConsumer).setResumeStrategy(resumeStrategy);
+            resumeAwareConsumer.setResumeStrategy(resumeStrategy);
         }
 
         ServiceHelper.startService(delegatedEndpoint, delegatedConsumer);
diff --git a/core/camel-api/src/main/java/org/apache/camel/resume/ResumeAdapter.java b/core/camel-api/src/main/java/org/apache/camel/resume/ResumeAdapter.java
index ae650304d3c..8178ee665ac 100644
--- a/core/camel-api/src/main/java/org/apache/camel/resume/ResumeAdapter.java
+++ b/core/camel-api/src/main/java/org/apache/camel/resume/ResumeAdapter.java
@@ -28,6 +28,7 @@ package org.apache.camel.resume;
  * resume API, as well as to offer component-specific interfaces that can be specialized by other integrations.
  */
 public interface ResumeAdapter {
+    String RESUME_ADAPTER_FACTORY = "adapter-factory";
 
     /**
      * Execute the resume logic for the adapter
diff --git a/core/camel-api/src/main/java/org/apache/camel/resume/ResumeAware.java b/core/camel-api/src/main/java/org/apache/camel/resume/ResumeAware.java
index 10f59b3c00c..ffbc0fd3c75 100644
--- a/core/camel-api/src/main/java/org/apache/camel/resume/ResumeAware.java
+++ b/core/camel-api/src/main/java/org/apache/camel/resume/ResumeAware.java
@@ -35,4 +35,17 @@ public interface ResumeAware<T extends ResumeStrategy> {
      * @return the resume strategy
      */
     T getResumeStrategy();
+
+
+    /**
+     * Allows the implementation to provide custom adapter factories. It binds the service name provided in the
+     * {@link org.apache.camel.spi.annotations.JdkService} annotation in the adapter with the resume aware class. This
+     * allows the adapter to be resolved automatically in runtime while also allowing fallback to reusable adapters
+     * when available.
+     *
+     * @return
+     */
+    default String adapterFactoryService() {
+        return ResumeAdapter.RESUME_ADAPTER_FACTORY;
+    }
 }
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
index 2c8bec8a09d..2b596746d0f 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
@@ -644,7 +644,7 @@ public class DefaultRoute extends ServiceSupport implements Route {
             }
 
             if (consumer instanceof ResumeAware && resumeStrategy != null) {
-                ResumeAdapter resumeAdapter = AdapterHelper.eval(getCamelContext(), consumer);
+                ResumeAdapter resumeAdapter = AdapterHelper.eval(getCamelContext(), (ResumeAware) consumer);
                 resumeStrategy.setAdapter(resumeAdapter);
                 ((ResumeAware) consumer).setResumeStrategy(resumeStrategy);
             }
diff --git a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory
new file mode 100644
index 00000000000..dfe17f7da98
--- /dev/null
+++ b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.support.resume.ResumeActionAwareAdapter
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/resume/AdapterHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/resume/AdapterHelper.java
index 5fd8be1a4ed..e5426be582a 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/resume/AdapterHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/resume/AdapterHelper.java
@@ -20,10 +20,10 @@ package org.apache.camel.support.resume;
 import java.util.Optional;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.Consumer;
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.resume.Cacheable;
 import org.apache.camel.resume.ResumeAdapter;
+import org.apache.camel.resume.ResumeAware;
 import org.apache.camel.resume.cache.ResumeCache;
 import org.apache.camel.spi.FactoryFinder;
 import org.slf4j.Logger;
@@ -31,23 +31,23 @@ import org.slf4j.LoggerFactory;
 
 public final class AdapterHelper {
     private static final Logger LOG = LoggerFactory.getLogger(AdapterHelper.class);
-    private static final String ADAPTER_PROPERTIES = "/org/apache/camel/resume/";
-    private static final String ADAPTER_KEY = "Adapter";
 
     private AdapterHelper() {
     }
 
-    public static ResumeAdapter eval(CamelContext context, Consumer consumer) {
+    public static ResumeAdapter eval(CamelContext context, ResumeAware resumeAware) {
         assert context != null;
-        assert consumer != null;
+        assert resumeAware != null;
 
         LOG.debug("Using the factory finder to search for the resume adapter");
-        final FactoryFinder factoryFinder = context.adapt(ExtendedCamelContext.class).getFactoryFinder(ADAPTER_PROPERTIES);
+        final FactoryFinder factoryFinder = context.adapt(ExtendedCamelContext.class).getFactoryFinder(FactoryFinder.DEFAULT_PATH);
+
 
         LOG.debug("Creating a new resume adapter");
-        final Optional<ResumeAdapter> adapterOptional = factoryFinder.newInstance(ADAPTER_KEY, ResumeAdapter.class);
+        Optional<ResumeAdapter> adapterOptional = factoryFinder.newInstance(resumeAware.adapterFactoryService(), ResumeAdapter.class);
 
         if (!adapterOptional.isPresent()) {
+
             throw new RuntimeException("Cannot find a resume adapter class in the consumer classpath or in the registry");
         }
 
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/resume/ResumeActionAwareAdapter.java b/core/camel-support/src/main/java/org/apache/camel/support/resume/ResumeActionAwareAdapter.java
index 0bc07685ed7..03faf8f267d 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/resume/ResumeActionAwareAdapter.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/resume/ResumeActionAwareAdapter.java
@@ -25,7 +25,9 @@ import org.apache.camel.resume.Offset;
 import org.apache.camel.resume.OffsetKey;
 import org.apache.camel.resume.ResumeAction;
 import org.apache.camel.resume.ResumeActionAware;
+import org.apache.camel.resume.ResumeAdapter;
 import org.apache.camel.resume.cache.ResumeCache;
+import org.apache.camel.spi.annotations.JdkService;
 
 /**
  * A simple resume adapter that support caching, deserialization and actions. This is usually suitable for supporting
@@ -33,6 +35,7 @@ import org.apache.camel.resume.cache.ResumeCache;
  * (i.e.: such as when resuming from database components, where the resume operation can only be determined by the
  * integration itself)
  */
+@JdkService(ResumeAdapter.RESUME_ADAPTER_FACTORY)
 public class ResumeActionAwareAdapter implements ResumeActionAware, Cacheable, Deserializable {
     private ResumeCache<Object> cache;
     private ResumeAction resumeAction;