2
votes

I need the cachestore to be loaded at startup according to its configuration without any additional codes like :

CacheStore.load()

But in https://apacheignite.readme.io/docs/persistent-store , I could not come accross with an expression that it loads itself at startup automaticly.

am I missing something here or is there really no way to do this at boot time without conding?

Thx

1

1 Answers

0
votes

I see the following way that should work in your case:

  • implement org.apache.ignite.lifecycle.LifecycleBean interface and process org.apache.ignite.lifecycle.LifecycleEventType#AFTER_NODE_START event in the implementation;
  • when the event fires call cache("cache_name").localLoadCache() in bean's implementation. Entries for which a started node is either primary or backup will be stored on that node.
  • register your LifecycleBean implementation with IgniteConfiguration.setLifecycleBeans(lifeCycleBean) or the same way in Spring XML.

As a result when a node is started with such configuration the pre-loading will be started automatically because of registered LifecycleBean.

Here you can find an example on how to work with LifecycleBean in Ignite.