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

Jdbc Backed QueueChannel fail fast if DB is not initialized properly #8680

Closed
syedyusufh opened this issue Jul 17, 2023 · 1 comment · Fixed by #8690
Closed

Jdbc Backed QueueChannel fail fast if DB is not initialized properly #8680

syedyusufh opened this issue Jul 17, 2023 · 1 comment · Fixed by #8690

Comments

@syedyusufh
Copy link

JDBC backed MessageChannels that aren't DB initialized properly are continuing to run on an infinite loop. It would help if it fails fast when the DB is not initialized properly

For more information, please refer the below SO

https://stackoverflow.com/questions/76697482/spring-integration-jdbc-backed-queuechannel-delayed-delivery

@syedyusufh syedyusufh added status: waiting-for-triage The issue need to be evaluated and its future decided type: enhancement labels Jul 17, 2023
@artembilan artembilan added in: jdbc and removed status: waiting-for-triage The issue need to be evaluated and its future decided labels Jul 17, 2023
@artembilan artembilan added this to the 6.2.x milestone Jul 17, 2023
@artembilan
Copy link
Member

@artembilan artembilan modified the milestones: 6.2.x, 6.2.0-M2 Jul 28, 2023
@artembilan artembilan self-assigned this Jul 28, 2023
artembilan added a commit to artembilan/spring-integration that referenced this issue Jul 28, 2023
Fixes spring-projects#8680

If database is not initialized properly before application start, we may lose messages
at runtime when we fail to insert data into DB

* Implement `SmartLifecycle` on `JdbcMessageStore`, `JdbcChannelMessageStore`,
`JdbcMetadataStore`, and `DefaultLockRepository` to perform `SELECT COUNT` query in `start()`
to fail fast if no required table is present.
* Refactor `AbstractJdbcChannelMessageStoreTests` into JUnit 5 and use `MySqlContainerTest`
for more coverage
* Fix newly failed tests which had DB not initialized before
* Exclude `commons-logging` from `commons-dbcp2` dependency to avoid
classpath conflict
* Document the new feature
garyrussell added a commit that referenced this issue Jul 28, 2023
* GH-8680: Check DB for table on start

Fixes #8680

If database is not initialized properly before application start, we may lose messages
at runtime when we fail to insert data into DB

* Implement `SmartLifecycle` on `JdbcMessageStore`, `JdbcChannelMessageStore`,
`JdbcMetadataStore`, and `DefaultLockRepository` to perform `SELECT COUNT` query in `start()`
to fail fast if no required table is present.
* Refactor `AbstractJdbcChannelMessageStoreTests` into JUnit 5 and use `MySqlContainerTest`
for more coverage
* Fix newly failed tests which had DB not initialized before
* Exclude `commons-logging` from `commons-dbcp2` dependency to avoid
classpath conflict
* Document the new feature

* * Fix HTTP URL in the `DataSource-mysql-context.xml`

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

* * Add `setCheckDatabaseOnStart(false)` to disable the check query for all the SI JDBC components

* Fix language in Javadocs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants