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 Details

    • AbstractPersistenceEvent

      public AbstractPersistenceEvent()
    • AbstractPersistenceEvent

      public AbstractPersistenceEvent(Serializable pk)
  • Method Details

    • getId

      public Object getId()
      Description copied from interface: TransactionAwareEvent
      Returns a unique id. Two events with the same id in the same transaction will not get published twice.
      Specified by:
      getId in interface TransactionAwareEvent
      Returns:
      the id
    • publishOnCommitOnly

      public boolean publishOnCommitOnly()
      Description copied from interface: TransactionAwareEvent
      Decide 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:
      publishOnCommitOnly in interface TransactionAwareEvent
    • publish

      public boolean publish(int sourceNodeId, int targetNodeId)
      Description copied from interface: ClusterAwareEvent
      Decide whether this event should be broadcasted/received. Examples are
      • return (sourceNodeId==targetNodeId ); => will only publish to local cluster
      • return true; => will publish to all nodes
      • return (targetNodeId==14); => publish to dedicated node regardless of source
      Specified by:
      publish in interface ClusterAwareEvent
      Returns:
      true if event should be published from source cluster node to target cluster node