-
Notifications
You must be signed in to change notification settings - Fork 11
Make MaxPollCount Configurable. #18
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,13 +42,21 @@ public abstract class QueueMonitor { | |
|
||
private int maxPollCount = 100; | ||
|
||
public void setMaxPollCount(int maxPollCount) { | ||
this.maxPollCount = maxPollCount; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ArrayBlockingQueue is being initalized in the constructor with maxPollCount. If you wish to make use of this, please propagate it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching that. Done. |
||
} | ||
|
||
public int getMaxPollCount() { | ||
return maxPollCount; | ||
} | ||
|
||
public QueueMonitor(String queueName) { | ||
this.queueName = queueName; | ||
this.clock = Clock.systemDefaultZone(); | ||
this.peekedMessages = new LinkedBlockingQueue<>(); | ||
this.executorService = | ||
new ThreadPoolExecutor( | ||
1, 1, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(maxPollCount)); | ||
1, 1, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(getMaxPollCount())); | ||
} | ||
|
||
public List<QueueMessage> pop(int count, int waitTime, TimeUnit timeUnit) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2024 Orkes, Inc. | ||
* <p> | ||
* Licensed under the Orkes Community License (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* <p> | ||
* https://github.com/orkes-io/licenses/blob/main/community/LICENSE.txt | ||
* <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 io.orkes.conductor.mq.redis; | ||
|
||
import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
@ConfigurationProperties("conductor.queue") | ||
@Component | ||
@AutoConfiguration | ||
@EnableAutoConfiguration | ||
public class QueueMonitorProperties { | ||
private int maxPollCount = 100; | ||
|
||
public int getMaxPollCount() { | ||
return maxPollCount; | ||
} | ||
|
||
public void setMaxPollCount(int maxPollCount) { | ||
this.maxPollCount = maxPollCount; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would like to avoid bringing this in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I know why?
This dependency is required to initialise QueueMonitorProperties