You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/11/19 09:35:30 UTC

[GitHub] [camel-quarkus] JiriOndrusek opened a new pull request #3310: Graceful shutdown strategy used as default one

JiriOndrusek opened a new pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310


   fixes https://github.com/apache/camel-quarkus/issues/3179
   
   Adds following behavior:
   - in development mode, if no graceful shutdown timeout is set, there is no change (`noShutdownStrategy` is used)
   - in other cases `gracefulShutdownStrategy` (same a is used in the Camel) is used
   @ppalaga I think that this should be mentioned in some doc, do you have a suggestion where to write it? 
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] jamesnetherton merged pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
jamesnetherton merged pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310


   


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-975227826


   @aldettinger documentation is added.


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] aldettinger commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
aldettinger commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-973948124


   @JiriOndrusek Looks good, still few questions. Logically, it should make `quarkus.camel.main.shutdown.timeout=xxx` work. I don't see how to automatic test this but wonder if you have been able to check this manually on your machine ?


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-973995308


   I'll try to add a test.
   (@aldettinger I tested it locally with an app)
   What do you think about a doc change regarding this?


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-974106023


   @aldettinger I would say that the use of `DefaultShudownStrategy` is preferable in all cases, with one exception - dev mode - because of quick redeploy. (but if in dev-mode `camel.main.shutdownTimeout` is set, default shutdown strategy will be used)
   
   As for documentation. Current status was, that `NoShutdownStrategy` was used in all cases. This fix brings a change, which could affect some users. This is the reason, why I would say that doc should be updated - somewhere. (that default shutdown strategy was changed - mainly for not dev-mode)


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#discussion_r753115141



##########
File path: extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelContextProcessor.java
##########
@@ -102,6 +106,28 @@ CamelContextBuildItem context(
         return new CamelContextBuildItem(context);
     }
 
+    /**
+     * This step customizes camel context for development mode.
+     *
+     * @param recorder     the recorder
+     * @param capabilities the registered capabilities
+     * @param producer     producer of context customizer build item
+     */
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep(onlyIf = IsDevelopment.class)
+    public void developmenMode(

Review comment:
       I'll fix it.




-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
aldettinger commented on a change in pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#discussion_r753071325



##########
File path: extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelContextProcessor.java
##########
@@ -102,6 +106,28 @@ CamelContextBuildItem context(
         return new CamelContextBuildItem(context);
     }
 
+    /**
+     * This step customizes camel context for development mode.
+     *
+     * @param recorder     the recorder
+     * @param capabilities the registered capabilities
+     * @param producer     producer of context customizer build item
+     */
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep(onlyIf = IsDevelopment.class)
+    public void developmenMode(
+            CamelContextRecorder recorder,
+            Capabilities capabilities,
+            BuildProducer<CamelContextCustomizerBuildItem> producer) {
+        if (capabilities.isPresent(CamelCapabilities.MAIN)) {
+            String val = CamelSupport.getOptionalConfigValue("camel.main.shutdownTimeout", String.class, null);
+            if (val == null) {
+                //if no graceful timeout is set in development mode, graceful shutdown is replaced with no shutdown
+                producer.produce(new CamelContextCustomizerBuildItem(recorder.createNoShutdownStrategyCustomizer()));
+            }
+        }

Review comment:
       Shouldn't we also set no shutdown strategy in DEV mode when no running with main ?




-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#discussion_r753144137



##########
File path: extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelContextProcessor.java
##########
@@ -102,6 +106,28 @@ CamelContextBuildItem context(
         return new CamelContextBuildItem(context);
     }
 
+    /**
+     * This step customizes camel context for development mode.
+     *
+     * @param recorder     the recorder
+     * @param capabilities the registered capabilities
+     * @param producer     producer of context customizer build item
+     */
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep(onlyIf = IsDevelopment.class)
+    public void developmenMode(
+            CamelContextRecorder recorder,
+            Capabilities capabilities,
+            BuildProducer<CamelContextCustomizerBuildItem> producer) {
+        if (capabilities.isPresent(CamelCapabilities.MAIN)) {
+            String val = CamelSupport.getOptionalConfigValue("camel.main.shutdownTimeout", String.class, null);
+            if (val == null) {
+                //if no graceful timeout is set in development mode, graceful shutdown is replaced with no shutdown
+                producer.produce(new CamelContextCustomizerBuildItem(recorder.createNoShutdownStrategyCustomizer()));
+            }
+        }

Review comment:
       fixed

##########
File path: extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelContextProcessor.java
##########
@@ -102,6 +106,28 @@ CamelContextBuildItem context(
         return new CamelContextBuildItem(context);
     }
 
+    /**
+     * This step customizes camel context for development mode.
+     *
+     * @param recorder     the recorder
+     * @param capabilities the registered capabilities
+     * @param producer     producer of context customizer build item
+     */
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep(onlyIf = IsDevelopment.class)
+    public void developmenMode(

Review comment:
       fixed




-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on a change in pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on a change in pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#discussion_r753114893



##########
File path: extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelContextProcessor.java
##########
@@ -102,6 +106,28 @@ CamelContextBuildItem context(
         return new CamelContextBuildItem(context);
     }
 
+    /**
+     * This step customizes camel context for development mode.
+     *
+     * @param recorder     the recorder
+     * @param capabilities the registered capabilities
+     * @param producer     producer of context customizer build item
+     */
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep(onlyIf = IsDevelopment.class)
+    public void developmenMode(
+            CamelContextRecorder recorder,
+            Capabilities capabilities,
+            BuildProducer<CamelContextCustomizerBuildItem> producer) {
+        if (capabilities.isPresent(CamelCapabilities.MAIN)) {
+            String val = CamelSupport.getOptionalConfigValue("camel.main.shutdownTimeout", String.class, null);
+            if (val == null) {
+                //if no graceful timeout is set in development mode, graceful shutdown is replaced with no shutdown
+                producer.produce(new CamelContextCustomizerBuildItem(recorder.createNoShutdownStrategyCustomizer()));
+            }
+        }

Review comment:
       makes sense, I'll fix it.




-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek edited a comment on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek edited a comment on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-974064707


   @jamesnetherton , @aldettinger I added 3 tests:
   
   1. in core (not dev mode) - verifying that `DefaultShutdownStrategy` is used.
   2. in main-devmode - `CamelContextDefaultShutdownStrategyDevModeTest` -  if `camel.main.shutdownTimeout` is set, `DefaulShutdownStrategy` is used 
   3. in main-devmode - `CamelContextNoShutdownStrategyDevModeTest` -  if `camel.main.shutdownTimeout` is not set, `NoShutdownStrategy` is used 


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-974064707


   @jamesnetherton , @aldettinger I added 3 tests:
   
   1. in core (not dev mode) - verifying that `DefaultShutdownStrategy` is used.
   2. in main-devmode - `CamelContextNoShutdownStrategyDevModeTest` -  if `camel.main.shutdownTimeout` is set, `DefaulShutdownStrategy` is used 
   3. in main-devmode - `CamelContextNoShutdownStrategyDevModeTest` -  if `camel.main.shutdownTimeout` is not set, `NoShutdownStrategy` is used 


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#discussion_r753025675



##########
File path: extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelContextProcessor.java
##########
@@ -102,6 +106,28 @@ CamelContextBuildItem context(
         return new CamelContextBuildItem(context);
     }
 
+    /**
+     * This step customizes camel context for development mode.
+     *
+     * @param recorder     the recorder
+     * @param capabilities the registered capabilities
+     * @param producer     producer of context customizer build item
+     */
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep(onlyIf = IsDevelopment.class)
+    public void developmenMode(

Review comment:
       Can we name the method something a bit more meaningful like `devModeCamelContextCustomizations`.




-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-974133239


   @aldettinger 
   ```
   DefaultShudownStrategy is used in DEV mode when camel main is disabled. Do you agree with that ?
   ```
   Not entirely correct. `DefaultShutdownStrategy` is used in dev mode only if `camel.main.shutdownTimeout` is not null. (without taking into account whether camel main is disabled) - may not be the solution which we want. So in case that different condition should be applied, I'll change it.


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] aldettinger commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
aldettinger commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-975258237


   The migration guide is definitely the right place. We could merge this PR from my point of view :+1: 


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-974150153


   I hope that following statement will make the current behavior clear.
   
   Current implementation is using only `NoShutdownStrategy`.
    This fix changes strategy to `DefaultShutdownStrategy`,
   Only if `camel.main.shutdownTimeout` is not set and dev mode is enabled -  `NoShutdownStrategy` remains.


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] jamesnetherton commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-973958734


   > I don't see how to automatic test this
   
   As a minimum, we could probably use [`QuarkusDevModeTest`](https://github.com/apache/camel-quarkus/blob/5ad13f2be3d6d8ccb771dcea4c37a7d0c600b24e/integration-tests/main-devmode/src/test/java/org/apache/camel/quarkus/main/CamelMainRoutesIncludePatternWithNoPrefixDevModeTest.java#L41) and verify that the correct shutdown strategy is configured on the `CamelContext`, depending on whether `camel.main.shutdownTimeout` is set.
   


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] aldettinger commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
aldettinger commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-974097860


   @JiriOndrusek It looks better :+1: 
   
   Do we have a test for core in DEV mode ? I mean without using camel-main in DEV mode. My current reading is that we will use the default shutdown strategy whereas no shutdown strategy would be preferrable ?
   
   About the doc change: Are you talking about stating in the doc that the shutdown strategy has changed ? IMHO, I don't think it is needed. 


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] aldettinger commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
aldettinger commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-974121450


   > I would say that the use of DefaultShudownStrategy is preferable in all cases, with one exception - dev mode - because of quick redeploy. (but if in dev-mode camel.main.shutdownTimeout is set, default shutdown strategy will be used)
   
   I agree. Maybe I missread that with the current implementation, `DefaultShudownStrategy` is used in DEV mode when camel main is disabled. Do you agree with that ?
   
   > As for documentation. Current status was, that NoShutdownStrategy was used in all cases. This fix brings a change, which could affect some users. This is the reason, why I would say that doc should be updated - somewhere. (that default shutdown strategy was changed - mainly for not dev-mode)
   
   Ok, it's clearer now. I think James has an idea that this could be in the migration guide. I think it is a good option.


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3310: Graceful shutdown strategy used as default one

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #3310:
URL: https://github.com/apache/camel-quarkus/pull/3310#issuecomment-974166399


   I'll add change into the migration doc -  https://github.com/apache/camel-quarkus/tree/main/docs/modules/ROOT/pages/migration-guide


-- 
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-unsubscribe@camel.apache.org

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