-
1. Re: Rerender dataTable from Quartz async call
asookazian Apr 19, 2010 11:06 PM (in response to ssarver)Not sure, but I'd like to know the best practice for this scenario...
-
2. Re: Rerender dataTable from Quartz async call
gaborj Apr 21, 2010 8:00 PM (in response to ssarver)The lookup of Seam comp from Quartz job works like a mercedes.
If your point is how to trigger the end of the asynch job, then I have s.g. in mind. Similar in concept but an other option can be using Remoting i.e. annotate your component @WebRemote, access your method from your custom JS method and rerender the table from this when finished.
Returning processing status (e.g. how many records are processed already and how much time it took) you can little more fine tune your remote call interval depending on the status of your asynch job.
It is similar if you set your interval="#{dynamicPushIntervalBasedOnWeightAndStatusOfJob}" in the a4j:push...
The more your statistical dispersion of asynch processing time the more it worth to implement the dynamic interval. In case of simple asynch logic it does not make much difference to the simple solution with static interval.
Some intermediate solution can be if you can approximate your job processing time needs e.g. before each schedule if needed...
-
3. Re: Rerender dataTable from Quartz async call
ssarver Apr 22, 2010 3:03 AM (in response to ssarver)
If your point is how to trigger the end of the asynch job, then I have s.g. in mind.What is s.g.?
-
4. Re: Rerender dataTable from Quartz async call
gaborj Apr 22, 2010 3:24 AM (in response to ssarver)s.g. is acronym for something. Actually, the thing I detailed in my post above...
Anyway, could you solve this in your way? Is it working? Are you happy with it?... -
5. Re: Rerender dataTable from Quartz async call
ssarver Apr 22, 2010 4:55 PM (in response to ssarver)I found a working solution.
I added the event listener methods above to a listenerService bean with application scope.
I added the @Observer to the updateTable method. In the Quartz async call, I raise an event using:Events.instance().raiseEvent("remoteJobs.updated");
@Name("listenerService") @Scope(ScopeType.APPLICATION) public class ListenerService { @Logger private Log log; private PushEventListener listener; public void addListener(EventListener el) { if (listener != el) { listener = (PushEventListener) el; } } @Observer("remoteJobs.updated") public void renderDataTable() { try { if (null != listener) { listener.onEvent(new EventObject(this)); } } catch (Exception e) { e.printStackTrace(); } } }
<a:region> <h:form> <a:push reRender="hostTable, ds" eventProducer="#{listenerService.addListener}" interval="5000"/> </h:form> </a:region>