You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "hamed-hatami (via GitHub)" <gi...@apache.org> on 2023/07/27 19:17:57 UTC

[GitHub] [camel] hamed-hatami opened a new pull request, #10870: kinesis connection retry mechanism added into the current consumer

hamed-hatami opened a new pull request, #10870:
URL: https://github.com/apache/camel/pull/10870

   # Description
   
   <!--
   - Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   -->
   
   # Target
   
   - [ ] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [ ] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [ ] I checked that each commit in the pull request has a meaningful subject line and body.
   
   <!--
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   -->
   
   - [ ] I have run `mvn clean install -DskipTests` locally and I have committed all auto-generated changes
   
   <!--
   You can run the aforementioned command in your module so that the build auto-formats your code. This will also be verified as part of the checks and your PR may be rejected if if there are uncommited changes after running `mvn clean install -DskipTests`.
   
   You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
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] hamed-hatami commented on a diff in pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on code in PR #10870:
URL: https://github.com/apache/camel/pull/10870#discussion_r1277153554


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java:
##########
@@ -99,12 +101,20 @@ public Producer createProducer() throws Exception {
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor);
+        var kinesisConnection = KinesisConnection.getInstance();
+        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor, kinesisConnection);
         consumer.setSchedulerProperties(getSchedulerProperties());
+        startHealthChecks(kinesisConnection);
         configureConsumer(consumer);
         return consumer;
     }
 
+    private void startHealthChecks(KinesisConnection kinesisConnection) {

Review Comment:
   What a great idea, I've changed the code according to your suggestion



-- 
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] hamed-hatami commented on pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on PR #10870:
URL: https://github.com/apache/camel/pull/10870#issuecomment-1655839103

   BTW, something regarding the connection in previous implementation before this PR, it gets a new connection almost for every either getClient() or getAsyncClient() whereas within new imple , it's a singleton connection which takes care of single connection till it's down 


-- 
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] hamed-hatami commented on a diff in pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on code in PR #10870:
URL: https://github.com/apache/camel/pull/10870#discussion_r1277572887


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java:
##########
@@ -99,12 +101,20 @@ public Producer createProducer() throws Exception {
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor);
+        var kinesisConnection = KinesisConnection.getInstance();
+        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor, kinesisConnection);
         consumer.setSchedulerProperties(getSchedulerProperties());
+        startHealthChecks(kinesisConnection);
         configureConsumer(consumer);
         return consumer;
     }
 
+    private void startHealthChecks(KinesisConnection kinesisConnection) {

Review Comment:
   If it looks OK, please resolve 



-- 
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] github-actions[bot] commented on pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10870:
URL: https://github.com/apache/camel/pull/10870#issuecomment-1654367388

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :camel: Maintainers, please note that first-time contributors *require manual approval* for the GitHub Actions to run.
   
   :warning: Please note that the changes on this PR may be **tested automatically** if they change components.
   
   :robot: Use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
   
   If necessary Apache Camel Committers may access logs and test results in the job summaries!


-- 
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] hamed-hatami commented on pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on PR #10870:
URL: https://github.com/apache/camel/pull/10870#issuecomment-1655830490

   Even if there was a way to check the healthiness of Kinesis but still it's tricky not to check the specific stream channel not to be chocked and working properly 


-- 
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] hamed-hatami commented on a diff in pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on code in PR #10870:
URL: https://github.com/apache/camel/pull/10870#discussion_r1277153554


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java:
##########
@@ -99,12 +101,20 @@ public Producer createProducer() throws Exception {
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor);
+        var kinesisConnection = KinesisConnection.getInstance();
+        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor, kinesisConnection);
         consumer.setSchedulerProperties(getSchedulerProperties());
+        startHealthChecks(kinesisConnection);
         configureConsumer(consumer);
         return consumer;
     }
 
+    private void startHealthChecks(KinesisConnection kinesisConnection) {

Review Comment:
   @oscerd  What a great idea, I've changed the code according to your suggestion



-- 
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] oscerd commented on a diff in pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #10870:
URL: https://github.com/apache/camel/pull/10870#discussion_r1277110406


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java:
##########
@@ -99,12 +101,20 @@ public Producer createProducer() throws Exception {
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor);
+        var kinesisConnection = KinesisConnection.getInstance();
+        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor, kinesisConnection);
         consumer.setSchedulerProperties(getSchedulerProperties());
+        startHealthChecks(kinesisConnection);
         configureConsumer(consumer);
         return consumer;
     }
 
+    private void startHealthChecks(KinesisConnection kinesisConnection) {

Review Comment:
   For this you could use the executor service we have in Camel, like we did here: 
   
   https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/stream/AWS2S3StreamUploadProducer.java#L83



-- 
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] davsclaus commented on pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #10870:
URL: https://github.com/apache/camel/pull/10870#issuecomment-1655798374

   Sorry I think this PR needed some attention but I did not have time today.
   
   This kind of health check is not standard way in Camel and I would like to revert this and discuss more how to do this in a better way.
   
   


-- 
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] hamed-hatami commented on a diff in pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on code in PR #10870:
URL: https://github.com/apache/camel/pull/10870#discussion_r1277247730


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java:
##########
@@ -99,12 +101,20 @@ public Producer createProducer() throws Exception {
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor);
+        var kinesisConnection = KinesisConnection.getInstance();
+        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor, kinesisConnection);
         consumer.setSchedulerProperties(getSchedulerProperties());
+        startHealthChecks(kinesisConnection);
         configureConsumer(consumer);
         return consumer;
     }
 
+    private void startHealthChecks(KinesisConnection kinesisConnection) {

Review Comment:
   @oscerd  it's ready to go, I suppose



-- 
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] hamed-hatami commented on pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on PR #10870:
URL: https://github.com/apache/camel/pull/10870#issuecomment-1655726972

   @oscerd  It looks OK ?


-- 
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] hamed-hatami commented on a diff in pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on code in PR #10870:
URL: https://github.com/apache/camel/pull/10870#discussion_r1277502077


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/Kinesis2Endpoint.java:
##########
@@ -99,12 +101,20 @@ public Producer createProducer() throws Exception {
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor);
+        var kinesisConnection = KinesisConnection.getInstance();
+        final Kinesis2Consumer consumer = new Kinesis2Consumer(this, processor, kinesisConnection);
         consumer.setSchedulerProperties(getSchedulerProperties());
+        startHealthChecks(kinesisConnection);
         configureConsumer(consumer);
         return consumer;
     }
 
+    private void startHealthChecks(KinesisConnection kinesisConnection) {

Review Comment:
   @Andrea Cosentino Please retrigger the pipeline one more time



-- 
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] oscerd merged pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd merged PR #10870:
URL: https://github.com/apache/camel/pull/10870


-- 
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] hamed-hatami commented on pull request #10870: kinesis connection retry mechanism added into the current consumer

Posted by "hamed-hatami (via GitHub)" <gi...@apache.org>.
hamed-hatami commented on PR #10870:
URL: https://github.com/apache/camel/pull/10870#issuecomment-1655816350

   No problem if you wanna revert it but I see no specific way in camel to do fault tolerance, I wanted to use MP fault tolerance such as retry mechanism, I found nothing at that level, maybe in Quarkus level you can do it much more easier


-- 
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