Class AbstractPersistenceEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
de.hybris.platform.servicelayer.event.events.AbstractEvent
de.hybris.platform.servicelayer.event.events.AbstractPersistenceEvent
- All Implemented Interfaces:
ClusterAwareEvent,TransactionAwareEvent,Serializable
- Direct Known Subclasses:
AfterItemCreationEvent,AfterItemRemovalEvent
public abstract class AbstractPersistenceEvent
extends AbstractEvent
implements TransactionAwareEvent, ClusterAwareEvent
Abstract event class for persistence related events.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()Returns a unique id.booleanpublish(int sourceNodeId, int targetNodeId) Decide whether this event should be broadcasted/received.booleanDecide whether this event should be broadcasted/received delayed on commit or directly this is useful if you want to publish custom event depending on the success of a running transaction if no transaction is running, the event is being sent immediately.Methods inherited from class de.hybris.platform.servicelayer.event.events.AbstractEvent
getScope, getSource, isFromCluster, setFromCluster, setScope, toStringMethods inherited from class org.springframework.context.ApplicationEvent
getTimestampMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.hybris.platform.servicelayer.event.ClusterAwareEvent
canPublish
-
Constructor Details
-
AbstractPersistenceEvent
public AbstractPersistenceEvent() -
AbstractPersistenceEvent
-
-
Method Details
-
getId
Description copied from interface:TransactionAwareEventReturns a unique id. Two events with the same id in the same transaction will not get published twice.- Specified by:
getIdin interfaceTransactionAwareEvent- Returns:
- the id
-
publishOnCommitOnly
public boolean publishOnCommitOnly()Description copied from interface:TransactionAwareEventDecide whether this event should be broadcasted/received delayed on commit or directly this is useful if you want to publish custom event depending on the success of a running transaction if no transaction is running, the event is being sent immediately.- Specified by:
publishOnCommitOnlyin interfaceTransactionAwareEvent
-
publish
public boolean publish(int sourceNodeId, int targetNodeId) Description copied from interface:ClusterAwareEventDecide whether this event should be broadcasted/received. Examples arereturn (sourceNodeId==targetNodeId );=> will only publish to local clusterreturn true;=> will publish to all nodesreturn (targetNodeId==14);=> publish to dedicated node regardless of source
- Specified by:
publishin interfaceClusterAwareEvent- Returns:
trueif event should be published from source cluster node to target cluster node
-