-
1. Re: Observation: PROPERTY_ADDED fired, but new Property not found
rhauch Nov 30, 2011 12:12 PM (in response to jonathandfields)The events are not be fired before the changes are actually persisted to the connector, so what's actually happening is that the session likely doesn't "see" the property because it's already read the node without the new property. This is a side-effect of the "copy-on-read" behavior of ModeShape.
In what session are you trying to get the property? You should *not* be doing this work on the session that the listener was registered with; instead, you should be creating a new session. If you're reusing a session that existed prior to the property being added, you'll have to refresh the node (or the entire session) to see the changes on that property.
BTW, this behavior will be different in 3.0: we're actually changing the session's behavior to so that it sees its changes applied on top of the existing persisted state. This is almost "copy-on-write", except that a session never "copies" anything but merely holds onto the transient changes made with the session.
-
2. Re: Observation: PROPERTY_ADDED fired, but new Property not found
jonathandfields Nov 30, 2011 12:32 PM (in response to rhauch)I was trying to get the property in the (long running) EventListener Session, so that is the problem.
Basically, the EventListener receives the Events, and puts messages onto a JMS queue based only upon the information in the Event itself.
However, in this particular case, it was attempting to get the property, because it's value determines what goes into the JMS message. Everywhere else, I was only accessing the Event, and not doing anything with the Session.
I'll change that so the EventListener forwards the Events to another Session to actually handle them.