You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by suhuadong <su...@163.com> on 2016/10/24 13:19:55 UTC

How to continuously subscribe for event?

hi,team

My cache subscribe the EVT_CACHE_OBJECT_EXPIRED,I want the event trigger
every a minute.
But,I find that the event only trigger once.

My code:

   IgnitePredicate<CacheEvent> rmtLsnr = new Task();
       
Ignition.ignite().events(Ignition.ignite().cluster().forCacheNodes("myCache")).remoteListen(null,rmtLsnr,
EventType.EVT_CACHE_OBJECT_EXPIRED);



static class Task implements  IgnitePredicate<CacheEvent>,Serializable {
        private static final long serialVersionUID = 6529685098267757690L;
        
        @Override
        public boolean apply(CacheEvent evt) {
            System.out.println(oldVal.getClass());
            Ignition.ignite().cache("myCache").put(dvId,oldVal);
      }





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-continuously-subscribe-for-event-tp8438.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to continuously subscribe for event?

Posted by vkulichenko <va...@gmail.com>.
Hi,

Can you create a small example project (e.g. on GitHub) that reproduces the
issue?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-continuously-subscribe-for-event-tp8438p8482.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to continuously subscribe for event?

Posted by suhuadong <su...@163.com>.
hi Manu,
My code contain't "return true".
I omit the code when  I copy the code to textbox. 



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-continuously-subscribe-for-event-tp8438p8453.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to continuously subscribe for event?

Posted by Manu <ma...@hotmail.com>.
Hi,

You need to return true on apply method to continuously listen.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-continuously-subscribe-for-event-tp8438p8442.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.