orpiske commented on a change in pull request #6947:
URL: https://github.com/apache/camel/pull/6947#discussion_r816569456



##########
File path: 
core/camel-core-processor/src/main/java/org/apache/camel/processor/resume/ResumableProcessor.java
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.
+ */
+
+package org.apache.camel.processor.resume;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.Exchange;
+import org.apache.camel.Navigate;
+import org.apache.camel.Processor;
+import org.apache.camel.Resumable;
+import org.apache.camel.ResumeStrategy;
+import org.apache.camel.spi.IdAware;
+import org.apache.camel.spi.RouteIdAware;
+import org.apache.camel.spi.Synchronization;
+import org.apache.camel.support.AsyncProcessorConverterHelper;
+import org.apache.camel.support.AsyncProcessorSupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ResumableProcessor extends AsyncProcessorSupport
+        implements Navigate<Processor>, CamelContextAware, IdAware, 
RouteIdAware {
+    private static final Logger LOG = 
LoggerFactory.getLogger(ResumableProcessor.class);
+    private CamelContext camelContext;
+    private ResumeStrategy resumeStrategy;
+    private AsyncProcessor processor;
+    private String id;
+    private String routeId;
+
+    private static class ResumableProcessorCallback implements AsyncCallback {
+
+        private final Exchange exchange;
+        private final Synchronization completion;
+        private final AsyncCallback callback;
+
+        public ResumableProcessorCallback(Exchange exchange, Synchronization 
completion, AsyncCallback callback) {
+            this.exchange = exchange;
+            this.completion = completion;
+            this.callback = callback;
+        }
+
+        @Override
+        public void done(boolean doneSync) {
+            try {
+                if (exchange.isFailed()) {
+                    completion.onFailure(exchange);
+                } else {
+                    completion.onComplete(exchange);
+                }
+            } finally {
+                callback.done(doneSync);
+            }
+        }
+    }
+
+    public ResumableProcessor(ResumeStrategy resumeStrategy, Processor 
processor) {
+        this.resumeStrategy = Objects.requireNonNull(resumeStrategy);
+        this.processor = AsyncProcessorConverterHelper.convert(processor);
+
+        LOG.info("Enabling the resumable strategy of type: {}", 
resumeStrategy.getClass().getSimpleName());

Review comment:
       Good catch. Also, this one also should probably be debug/trace. I'll 
fix. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to