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.
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 last
phaseis 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.
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.
smart, i like that:)