How to cleanup the metadata store used for idempotent spring integration pattern

你说的曾经没有我的故事 提交于 2020-01-24 08:50:31

问题


I am using the idempotent receiver pattern in my spring integration flow to detect duplicate messages.

https://docs.spring.io/spring-integration/docs/5.0.5.RELEASE/reference/html/system-management-chapter.html#metadata-store

In above link it says

The value of the idempotent entry may be some expiration date, after which that entry should be removed from Metadata Store by some scheduled reaper.

Is there any utility/scheduler available that is provided by spring to clean up the INT_METADATA_STORE table ?


回答1:


Well, there is no such a built-in tool for the MetadaStore clean up, although I believe we need to add: that's not a first time when we get a request to be able to delete (or expire) some old entries in the store. Feel free to raise a JIRA on the matter. Looks like we need to add some extra column: UPDATE_DATE to be able to compare it with some time from the expireUnusedOlderThan(long age) callback. Something similar what we have with the ExpirableLockRegistry.

Since you talk about an INT_METADATA_STORE table, I believe you can use for time being a plain JdbcTemplate and some scheduled task from the Spring Framework: https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#scheduling-annotation-support



来源:https://stackoverflow.com/questions/51839414/how-to-cleanup-the-metadata-store-used-for-idempotent-spring-integration-pattern

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!