How to cleanup the JdbcMetadataStore?

前端 未结 1 608
野趣味
野趣味 2021-01-20 10:02

Initially our flow of cimmunicating with google Pub/Sub was so:

  1. Application accepts message
  2. Checks that it doesn\'t exist in idempotencyStore
相关标签:
1条回答
  • 2021-01-20 10:32

    In the acknowledge successfull callback - remove this msg from metadatastore

    I don't see a reason in this step at all.

    Since you say that you store in the value a timestamp that means that you can analyze this table from time to time to remove definitely old entries.

    In some my project we have a daily job in DB to archive a table for better main process performance. Right, just because we don't need old data any more. For this reason we definitely check some timestamp in the raw to determine if that should go into archive or not. I wouldn't remove data immediately after process just because there is a chance for redelivery from external system.

    On the other hand for better performance I would add extra indexed column with timestamp type into that metadata table and would populate a value via trigger on each update or instert. Well, MetadataStore just insert an entry from the MetadataStoreSelector:

    return this.metadataStore.putIfAbsent(key, value) == null;
    

    So, you need an on_insert trigger to populate that date column. This way you will know in the end of day if you need to remove an entry or not.

    0 讨论(0)
提交回复
热议问题