Hi,

On Wed, Aug 3, 2011 at 6:29 PM, mmjose26 <[email protected]> wrote:
> Hi! I'm trying to implement some logic after of add some nodes to repository.
> I'm using asynchronous listener, and for each node of type X, the listener
> do version on it.
>
> I'm using transactional scenario, and all happen on commit. Almost always,
> the commit invalidate the session  just before that the listener be notified
> at all.  and the listener is not called.

Are you using the same session for both the listener and the
transaction? It's generally a good idea to use a separate long-lived
session for any event listeners you have.

Also, note that using the listener session for anything during the
onEvent() call is a bad practice, as you can't easily prevent
concurrent use of the session. Instead, if you need to do something
like create a new version in an event handler, I recommend either
using a task queue and a background worker thread (with its own
separate session) or launching a fresh new session for each new event
that needs repository writes.

BR,

Jukka Zitting

Reply via email to