-
1. Re: Asynchronous call from Observer
lvdberg Oct 11, 2010 2:45 AM (in response to slaweksss)Hi,
I solve this issue by adding an additional observer layer which is used to watch for the transaction success event, does some pre-processing (if necessary) and raise an Asynchronous event.
One of the advantages is that within the original call (with the transaction) the delay is decereased to a minimum and you're also able to call something with a new Transaction. So basically
Component --> raiseTransactionSuccess --> Component --> RaiseSyncronousEvent --> doSomething.
Hopefully this helps.
Leo
-
2. Re: Asynchronous call from Observer
slaweksss Oct 11, 2010 1:03 PM (in response to slaweksss)hmm nice trick:)
works like a charm.
thanks a lot Leo!I'm wondering is it possible to add a facesMessage to some context in the last
element of this chain
?
I know that lastphase
is asynchronous and works in different context (I guess) but it would be nice if user could see message in the n-th request in the future. -
3. Re: Asynchronous call from Observer
lvdberg Oct 11, 2010 1:51 PM (in response to slaweksss)Hi,
adding a message to the context is a bit more complex because you're running the task asynchronous and it no notion whatsoever of the context. However you can create messages without a problem. The thing I do is to send these messages to an Application scoped bean which hols the listener for an rich ajax-poll element. The meaaage is received and added to a Map which has the user as Key and a message List to which the message is added. At the moment the user-poll is triggered it reads the list with pending messages and adds them to the context.
Leo
-
4. Re: Asynchronous call from Observer
slaweksss Oct 11, 2010 4:04 PM (in response to slaweksss)smart, i like that:)
thanks again