/commented by valentin kulichenko/

You can use LifecycleBean with injected Ignite instance for this. It will be
invoked right after the node startup.

Here is the implementation example:

/*public class MyLifecycleBean implements LifecycleBean {
    @IgniteInstanceResource
    private Ignite ignite;

    @Override public void onLifecycleEvent(LifecycleEventType evt) throws
IgniteException {
        if (evt == LifecycleEventType.AFTER_NODE_START) {
            IgniteCache<Object, Object> cache = ignite.cache("myCache");

            // Load cache logic goes here...
        }
    }
}*/

Lifecycle bean should be configured like this:

/*<bean class="org.apache.ignite.IgniteConfiguration">
    ...
    <property name="lifecycleBeans">
        <list>
            <bean class="com.mycompany.MyLifecycleBean"/>
        </list>
    </property>
    ...
</bean>*/

----- 
/This post is migrated from now discontinued Apache Ignite forum at 
http://apacheignite.readme.io/v1.0/discuss/



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Cache-Loading-with-Spring-Best-Practice-tp224p225.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to