on 11-22-2013 9:58 AM
Hi all,
I'd like to launch a background/asynchronous task performing some logic.
I know that JEE6 includes the @asynchronous annotation for EJB 3.1 methods, but it's not supported in the EJB 3.1 Lite spec implemented.
In addition, the usage of JMS is not possible since HANA Cloud does not implement it.
How can I launch an asynchronous task?
Thanks and regards
Vincenzo
hi Vlado,
do you know whether there's any update on this?
thanks, regards
Vincenzo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Vincenzo,
EJB timers worked before we updated the EJB container - with the newest sdk versions, EJB timers require new versions of some sdk components. Currently we are considering updating these in a backward compatible way.
We'll keep you up to date with the news around this topic.
Kind regards,
Katya
Hi Vincenzo,
You are correct - asynchronous features (timers, MDBs) are not part of EJB Lite, and JMS is not part of Java EE 6 Web Profile (btw, it's Java EE, not JEE).
But... there is good news - you can use EJB timers with the SDK 2.x (though not officially supported). Check this blog for the details:
HTH!
--Vlado
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jan and Vlado,
thanks so much for your valuable ideas.
I understand the timer service is not official supported, though I appreciate it might most certainly work ok. Spring would certainly be a good choice, though adding an additional degree of complexity as it is a different framework.
I found out also that the Quartz API can provide good support in the matter of job scheduling.
A good blog is found here: http://scn.sap.com/people/aleksandar.zlatkovski/blog/2013/02/22/scheduling-jobs-on-sap-netweaver-clo...
Do you have any experience on this library or any opinion on whether it might be better/worse than the proposed options?
Thanks so much for your kind attention
Regards
Hi Vincenzo,
I'm using Quarz in a productive application on SAP HANA Cloud Platform by just following the exact blog post that you have referred to. It works perfectly for my use case to schedule a regular job to send some notification mails.
I haven't tried EJB timers though.
Best regards,
Vesselin
Well, Quartz is also a framework on itself, and it's specifically designed for job scheduling scenarios. I don't have that much experience with it as with EJB timers, basically it requires at least some integration efforts but also can support more complex scenarios. On the other hand, EJB timers work out of the box and are a good fit for most use cases.
So, if you don't need some very special features that are not available with the EJB timer service, I would recommend to go for EJB timers and see how it works for you. If you need more, you can always switch to Quartz
HTH!
--Vlado
Hi Vlado,
thanks, that makes sense. I have a couple more questions on how to use the EJB timer for emulating a Thread. For instance:
Thanks so much, regards
Vincenzo
Sorry Vincenzo, I somehow missed your response.
Sure, you can use the TimerService.createTimer(long duration, java.io.Serializable info) method and pass 0 as duration. The info object can be any Serializable object, which you can then get from the Timer passed to the EJB @Timeout method.
HTH!
--Vlado
Hi Vlado,
after a bit of time, I'm following up on this topic in my project.
I have created a Stateless EJB with a Timeout annotated method.
When I deploy it within the lib folder of a WAR archive to the local HCP I get errors like:
Exception: class java.lang.NoClassDefFoundError: org/quartz/simpl/RAMJobStore: org/quartz/simpl/RAMJobStore
And I am not using Quartz, just the plain EJB @Timeout.
Is there anything I'm missing?
Thanks a lot
Regards
Vincenzo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.