Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add channel custom delay #80

Merged
merged 2 commits into from
Oct 11, 2019
Merged

Conversation

thediantoni
Copy link

This is to add custom delay on channel #78. Please help to review.

@theanirudhvyas
Copy link
Contributor

@thediantoni are you working on this?

@thediantoni
Copy link
Author

@theanirudhvyas yes, we are still thinking to add exponential backoff as well


(defn- channel-retries-exponential-backoff-enabled [topic-entity channel]
(-> (ziggurat-config) :stream-router topic-entity :channels channel :retry :exponential-backoff-enabled))

(defn publish-to-channel-delay-queue [topic-entity channel message]
(let [{:keys [exchange-name queue-timeout-ms]} (:delay (rabbitmq-config))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thediantoni A doc-string will help here. Somewhere we need to explain the new configs which have been introduced - channel delay/exponential backoff/channel specific queue timeout.

This doc-string can help with that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc-string added @mjayprateek

(let [message-from-mq (rmq/get-msg-from-channel-dead-queue topic-entity channel)]
(is (= expected-message message-from-mq))))))

(testing "message in channel will be retried with exponential queue timeout"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thediantoni how are we testing that exponential back-off was used? We're not measuring time taken anywhere.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @mjayprateek , extracted the logic to get-queue-timeout-ms and create the test for different queue timeout when exponential backoff is enabled

:channel-exponential-retry #(constantly nil)}}
(let [retry-count (atom 2)
topic-entity :default
channel :channel-exponential-retry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thediantoni testing.. says channel exponential queue timeout but config.end has defined queue-timeout-ms for exponential-retry, not for channel-exponential-retry.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if queue-timeout-ms not defined for channel-exponential-retry, it will use timeout config from ziggurat rabbit-mq delay queue-timeout-ms

@mjayprateek mjayprateek merged commit 7b10616 into gojek:2.x Oct 11, 2019
@thediantoni thediantoni deleted the channel-custom-delay branch October 11, 2019 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants