origamins
origamins

Reputation: 78

Payara micro - persistent timer

Is it possible to have persistent EJB timer service with Payara Micro?

I would like to have two or more application instances in cluster. There is scheduled task (@Schedule) in application. I do not like all instances to run the timer, just one instance should run it, either but exactly one.

This should work with persistent=true in @Schedule like:

@Schedule(second = "*/5", minute = "*", hour = "*", persistent=true)

but... on deploy time I receive message:

javax.ejb.CreateException: Persistent timers are not supported in this setup

If I deploy with persistent=false, it works, but all cluster instances execute the timer:

@Schedule(second = "*/5", minute = "*", hour = "*", persistent=false)

Does this means I should use full Payara (Glassfish) with full JEE support, or there is another way to enable this in Payara Micro? I would like to stick to simple standard solutions, without custom code and 3th libraries.

For testing, I run my instances with:

java -jar payara-micro-4.1.1.162.jar --autoBindHttp --deploy my.war

Thank you in advance

Upvotes: 2

Views: 1037

Answers (1)

Mike
Mike

Reputation: 4963

Persistent EJB timers powered by Hazelcast are coming with Payara Micro 163, due to be released very soon!

Upvotes: 2

Related Questions