[jboss-user] [JBoss Seam] - Starting up Asynchronous Method at startup
damatrix
do-not-reply at jboss.com
Mon Aug 20 08:50:43 EDT 2007
Hi,
I've been trying to get an asynchronous process to run immediately after startup of the application to automatically send email notifications. On a previous post someone recommended annotating an APPLICATION scope component method with @Observer("org.jboss.seam.postInitialize").
However i find that the method is still not called after startup. Am i missing something. Below is the Applicaition Scope component and the component with the asynchronous method.
| @Scope(ScopeType.APPLICATION)
| @Name("tradewindsMonitor")
| public class TimerMonitor implements java.io.Serializable{
|
| @In(create=true)
| TradewindsMonitorBean timerHandler;
|
| @Observer("org.jboss.seam.postInitialize")
| public void startTimer(){
| Calendar calendar = Calendar.getInstance();
| calendar.add(Calendar.MINUTE,2);
| timerHandler.sendNotifications(calendar.getTime(),new Long(86400000));
| }
|
| @Name("timerHandler")
| public class TradewindsMonitorBean implements java.io.Serializable{
|
| @In(create=true)
| private Timer timer;
|
| @In(create = true)
| private MailRenderer mailRenderer;
| @In
| private EntityManager entityManager;
|
| @Asynchronous
| public Timer sendNotifications(@Expiration java.util.Date date, @IntervalDuration Long duration) {
| ...
| return timer;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075823#4075823
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075823
More information about the jboss-user
mailing list