jBoss Seam 2.0 Beta 1 Asynchronicity issues
vadger Aug 15, 2007 3:48 PMHello,
I'm trying to launch asynchronicity and I've faced with a number of problems.
What I've done:
@Stateless
@Name("prevedMedved")
public class PrevedBean implements IPreved {
@Logger
private Log log;
@In(create = true)
TaskHandler taskHandler;
@Observer("org.jboss.seam.postInitialization")
public void sayPreved() {
log.info("PREVEEED MEDVEEEEEED!!!!! ##################");
log.info("IBVOKING TASKING4 after 1 minute");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MINUTE, 1);
taskHandler.sayGreeting("PREVED, KROSAV4EGI", cal.getTime(), 1000L);
}
}
@Local
public interface TaskHandler {
@Asynchronous
void sayGreeting(String greeting, @Expiration Date date, @IntervalDuration Long interval);
}
@AutoCreate
@Name("taskHandler")
public class TaskHandlerBean implements TaskHandler {
@Logger
Log log;
@Override
public void sayGreeting(String greeting, Date date, Long interval) {
log.info("greeting: #0 at #1", greeting, new Date());
}
}I just tried to make tasking by example given in documentation.
When the method sayPreved is being invoked after deployment the method sayGreeting is invoked immediatly - not after 1 minute as I expected. In addition I don't see any recurrent invocation. What am I doing wrong?
Another issue. I tried to add <async:timer-service-dispatcher/> to the components.xml as it is written in documentation to use EJB3 Timer. In application deployment I got initilization exception:
.....
Caused by: org.dom4j.DocumentException: Error on line 44 of document : The prefix "async" for element "async:timer-service-dispatcher" is not bound. Nested exception: The prefix "async" for element "async:timer-service-dispatcher" is not bound.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.io.SAXReader.read(SAXReader.java:343)
at org.jboss.seam.util.XML.getRootElement(XML.java:16)
at org.jboss.seam.init.Initialization.initComponentsFromXmlDocument(Initialization.java:130)
As I understand, the schema location for async is not specified. Is it bug?
Thanks