Skip to content

Conversation

bandalgomsu
Copy link
Contributor

This PR introduces a configurable phase property in RedisMessageListenerContainer.
Previously, the container always used Integer.MAX_VALUE as its SmartLifecycle phase, making it difficult to align startup/shutdown ordering with other SmartLifecycle beans.
#3208

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

…in RedisMessageListenerContainer.

Signed-off-by: Su Ko <[email protected]>
Copy link
Member

@mp911de mp911de left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request. Care to also add a field for the autoStartup property? That would nicely align with JedisConnectionFactory and LettuceConnectionFactory.

@mp911de mp911de changed the title [GH-3208] Feat: Allow overriding phase in RedisMessageListenerContainer Allow configuring phase in RedisMessageListenerContainer Sep 29, 2025
@mp911de mp911de linked an issue Sep 29, 2025 that may be closed by this pull request
@bandalgomsu
Copy link
Contributor Author

Done ! 🙂

Copy link
Contributor

@onobc onobc left a comment

Choose a reason for hiding this comment

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

👋🏻 @bandalgomsu ,

Thank you for this excellent contribution! It is looking good.

Do you mind adding the same treatment to the org.springframework.data.redis.stream.DefaultStreamMessageListenerContainer as it also adheres to the SmartLifecycle contract and will likely benefit from this improvement?

Thanks

@bandalgomsu
Copy link
Contributor Author

Hi @onobc

What do you think about allowing 'phase' and 'autoStartup' to be configured either on 'StreamMessageListenerContainer' or through 'StreamMessageListenerContainerOptions' ? ?
Thanks 🙂

@bandalgomsu bandalgomsu force-pushed the issue/3208 branch 2 times, most recently from 2bd17c9 to 0e59f19 Compare September 30, 2025 06:47
@mp911de
Copy link
Member

mp911de commented Sep 30, 2025

StreamMessageListenerContainerOptions sounds good.

@onobc
Copy link
Contributor

onobc commented Sep 30, 2025

StreamMessageListenerContainerOptions sounds good.

Agreed. Good suggestion @bandalgomsu .

@onobc onobc force-pushed the main branch 2 times, most recently from f5d7dd2 to 396711e Compare September 30, 2025 16:52
…hase' in `DefaultStreamMessageListenerContainer`

Signed-off-by: Su Ko <[email protected]>
…hase' in `StreamMessageListenerContainerOptions`

Signed-off-by: Su Ko <[email protected]>
@bandalgomsu
Copy link
Contributor Author

The implementation has been completed. Could you review it ?? 🙂

@bandalgomsu bandalgomsu requested a review from onobc October 1, 2025 00:58
onobc pushed a commit that referenced this pull request Oct 1, 2025
This commit allows configuration of the `phase` and `autoStartup` lifecycle attributes on the `RedisMessageListenerContainer` and `DefaultStreamMessageListenerContainer`.

Original Pull Request: #3224
Resolves: #3208

Signed-off-by: Su Ko <[email protected]>
onobc added a commit that referenced this pull request Oct 1, 2025
Removes the lifecycle setters from the stream container as it should be configured via the stream options.

Also rewords the javadoc comments and moves the autoStartup get/set by the phase get/set.

Original Pull Request: #3224
Related tickets: #3208

Signed-off-by: Chris Bono <[email protected]>
@onobc
Copy link
Contributor

onobc commented Oct 1, 2025

Thank you @bandalgomsu for the excellent enhancement - much appreciated. I added a minor polish commit here and am closing this PR in favor of c88d6b1

@onobc onobc closed this Oct 1, 2025
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 2, 2025
@mp911de mp911de added this to the 4.0 RC1 (2025.1.0) milestone Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow overriding phase in RedisMessageListenerContainer
4 participants