Check chapter 19 of docs
which deals with asynchronicity.
From there, you can easily call asynchronous methods while having full access to the seam context.
Just some not-so-well documented caveats:
1) The implementation is based on either the EJB Timer service or Quartz. I've found that the Quartz implementation is far more reliable.
2) If you use anything but Quartz configured for in-memory job storage, You'll probably run into transaction problems if your datasources are not XA. Check the wiki for help configuring them. Also, MySQL Connectors and XA Transactions is lottery game! If thing blow for no reason, you might want to check tem.
Well, thank you for your reply.
I am familiar with that part of the documentation. Maybe me question was not clear enough.
In the documentation you got the example of calling a void method. In my case, I want to call 2 methods which both return a value (e.g. user and contract data).
I am not sure you to build a system that
waitsfor the calls and only then proceeds...
What you are probably looking for is a method that returns a handle to the task, which must be done using the EJBTimer implementation (or Quartz if it supports it). Then you can keep checking that task until it is finished and read off the data. I would check the EJB documentation for this one, because this is actually separate from Seam. Seam just facilitates the use of the asynchronous mechanism.
By the way, you left out an implementation. By default, Seam uses the Java 5 concurrent library to execute asynchronous methods. There are three limitations with it: it is not persistence (meaning the task might never execute), it does not support scheduling, and (I think) you cannot monitor the task.
Thanks very much for the reply!
True. My bad :)
BTW, I've posted a patch in JIRA to inject the QuartzTriggerHandle into the context - the same behavior of the EJB Timer implementation.
Otherwise, I couldn't make a repeating job cancel itself.