Skip to content

Conversation

bandalgomsu
Copy link

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
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

* Specify the lifecycle phase for this container.
* Lower values start earlier and stop later.
* The default is {@code Integer.MAX_VALUE}.
*
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mind adding a @since 4.0.0 tag here and in the setAutoStartup as well?

Copy link
Member

Choose a reason for hiding this comment

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

Nit: 4.0 instead of 4.0.0

@bandalgomsu
Copy link
Author

Hi @onobc

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

…hase' in `DefaultStreamMessageListenerContainer`

Signed-off-by: Su Ko <[email protected]>
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow overriding phase in RedisMessageListenerContainer
4 participants