Announcement Announcement Module
No announcement yet.
How to integrate ehcache? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to integrate ehcache?



    I've an ETL process where in I need to read CSVs and transform them based on lookups in the cache before loading to the data warehouse. In my existing ETL application I would prime the cache at the application start and use it later.

    I'm finding it difficult to initialize the cache before the transformation step starts with Spring Batch.

    After reading the documentation there is a way in which I think I can achieve this but not sure;
    1. In a separate step before the transformation step I can read from database to populate the cache and then finally store the reference to CacheManager to step execution context which may later be retrieved as per the documentation (refer #11.8)

    However, I'm not sure if this is the right way to achieve this. Further, I'm also not sure how to 'promote' step execution context to job execution mentioned in the same section.

    Any help is appreciated. Thanks again.


  • #2
    you can indeed use a first step to initialize your cache. You don't have to put the CacheManager in the execution context, you can use dependency injection (inject the CacheManager where you need it, in item readers, processors, etc.)

    be careful not to store too many things in memory though.


    • #3
      Thanks! I figured that out a few days back.. the answer was blowing in the wind!!