forked from conductor-oss/conductor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AMQP enhancements for resiliency and concurrency (#2587)
* AMQP messages will generate the observable change * Reverting unnecessary changes * Capturing the only changes required for AMQP messagres reading * Capturing the only changes required for AMQP messagres reading * Support for sequential and parallel processing of messages * Channel reusability changes * Channel reusability changes * Subscriber channel caching * Max channel changes * Connection and opertion retries * Channel usage for exchanges and publishers * Acknowledge the message even on failures * Resolved conflicts * Apply coding style changes using spotless * Retry on publish and ack failures * Externalizing the redis config * Externalizing the redis config * Make Event System Task Synchronous Event is a task that publishes messages to an external eventing system. The publishing is not a long running task, and publishing message to an async system using async task is not optimal. marking event as sync, improves the overall performance and has negligible overhead given the task completes quite quick. * Update integration tests to reflect Event is synchronous * Getting the latest changes Co-authored-by: Thangella, Venkat <[email protected]> Co-authored-by: Viren Baraiya <[email protected]>
- Loading branch information
1 parent
c3e85a5
commit 9ffcabc
Showing
20 changed files
with
988 additions
and
437 deletions.
There are no files selected for viewing
400 changes: 261 additions & 139 deletions
400
contribs/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPConnection.java
Large diffs are not rendered by default.
Oops, something went wrong.
435 changes: 337 additions & 98 deletions
435
contribs/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPObservableQueue.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...ribs/src/main/java/com/netflix/conductor/contribs/queue/amqp/config/AMQPRetryPattern.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2022 Netflix, Inc. | ||
* <p> | ||
* Licensed 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 com.netflix.conductor.contribs.queue.amqp.config; | ||
|
||
import com.netflix.conductor.contribs.queue.amqp.util.RetryType; | ||
|
||
public class AMQPRetryPattern { | ||
|
||
private int limit = 50; | ||
private int duration = 1000; | ||
private RetryType type = RetryType.REGULARINTERVALS; | ||
|
||
public AMQPRetryPattern() {} | ||
|
||
public AMQPRetryPattern(int limit, int duration, RetryType type) { | ||
this.limit = limit; | ||
this.duration = duration; | ||
this.type = type; | ||
} | ||
|
||
/** | ||
* This gets executed if the retry index is within the allowed limits, otherwise exception will | ||
* be thrown. | ||
* | ||
* @throws Exception | ||
*/ | ||
public void continueOrPropogate(Exception ex, int retryIndex) throws Exception { | ||
if (retryIndex > limit) { | ||
throw ex; | ||
} | ||
// Regular Intervals is the default | ||
long waitDuration = duration; | ||
if (type == RetryType.INCREMENTALINTERVALS) { | ||
waitDuration = duration * retryIndex; | ||
} else if (type == RetryType.EXPONENTIALBACKOFF) { | ||
waitDuration = (long) Math.pow(2, retryIndex) * duration; | ||
} | ||
try { | ||
Thread.sleep(waitDuration); | ||
} catch (InterruptedException ignored) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
contribs/src/main/java/com/netflix/conductor/contribs/queue/amqp/util/RetryType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 2020 Netflix, Inc. | ||
* <p> | ||
* Licensed 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 com.netflix.conductor.contribs.queue.amqp.util; | ||
|
||
/** RetryType holds the retry type */ | ||
public enum RetryType { | ||
REGULARINTERVALS, | ||
EXPONENTIALBACKOFF, | ||
INCREMENTALINTERVALS | ||
} |
Oops, something went wrong.