-
Notifications
You must be signed in to change notification settings - Fork 1.1k
INT-2595: Add time-based ReleaseStrategy
option
#1100
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
Conversation
Let me know, if it's OK and I'll add some docs. |
Travis failed with |
OK; when we merge my PR, rebase and |
|
||
public ReaperReleaseStrategy(ReleaseStrategy delegate, TaskScheduler taskScheduler, MessageGroupStore store, | ||
long interval, long timeout) { | ||
this.delegate = delegate; |
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 should probably assert that the delegate is not an RRR
.
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.
RRR
😄 . Right, I was thinking to make it as package protected
, but then I won't be able to configure it from DSL and I've protected us from this in JavaDocs.
This is really just a convenience for configuring the reaper - avoids a separate bean and scheduled task. If we stick with this technique, we should rename the attributes However, the alternative I was thinking of was to put logic in the Have a That way, we would only need |
</xsd:documentation> | ||
</xsd:annotation> | ||
</xsd:attribute> | ||
<xsd:attribute name="release-strategy-scheduler" type="xsd:string" default="taskScheduler"> |
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.
Just call this scheduler
, like in delayer
.
JIRA: https://jira.spring.io/browse/INT-2595 * Add `group-timeout` and `group-timeout-expression` to the Correlation Endpoint * Add logic to the `AbstractCorrelatingMessageHandler` to schedule group for `forceComplete`, when the target `ReleaseStrategy` returns `false`
Pushed. |
ReaperReleaseStrategy
ReleaseStrategy
option
@@ -294,6 +325,13 @@ protected void handleMessageInternal(Message<?> message) throws Exception { | |||
messageGroup = this.store(correlationKey, message); | |||
|
|||
if (releaseStrategy.canRelease(messageGroup)) { | |||
ScheduledFuture<?> scheduledFuture = this.expireGroupScheduledFutures.get(groupIdUuid); |
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 need to cancel the schedule regardless of whether we can release or not; we should do it as soon as possible after we get the lock, to minimize the possibility of interrupting the scheduled thread.
Cool! Or comments are good and reasonable. Will be applied |
@@ -166,6 +182,20 @@ public void setOutputChannelName(String outputChannelName) { | |||
this.outputChannelName = outputChannelName; | |||
} | |||
|
|||
public void setGroupTimeoutExpression(Expression groupTimeoutExpression) { |
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.
Wouldn't an overloaded method that takes a String
be easier for DSL, and @Bean
config?
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.
In DSL it will be populated from: https://github.com/spring-projects/spring-integration-extensions/blob/master/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/CorrelationHandlerSpec.java via methods groupTimeout(long value)
and groupTimeoutExpression(String expression)
and parsed internaly to the Expression
.
Pushed |
LGTM; I will do some testing tomorrow. We need to explain the relationship between this and the reaper; maybe the reaper can be deprecated ? On the other hand, maybe some people will still require the expiration to happen on a schedule rather than a separate schedule for each group. We should also explain again in the docs that what happens when the group times out depends on I wonder if we should add some logic to also allow removal of empty groups - i.e. schedule another Or, they can continue to use the reaper for removing empty groups. |
Pushed. Don't see reason to deprecate |
LGTM; a little doc and test polish here... garyrussell@11b0cfd |
Thanks, Gary. I applied your polishing - continue to study english 😄. |
Your English is amazing! Just a little more polish here garyrussell@7fec667 and then I think I can merge. |
Polishing - LGTM. |
Agree - will do. |
Merged |
JIRA: https://jira.spring.io/browse/INT-2595
group-timeout
andgroup-timeout-expression
to the Correlation EndpointAbstractCorrelatingMessageHandler
to schedule group forforceComplete
,when the target
ReleaseStrategy
returnsfalse