Class PlatformEventListener

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

    public class PlatformEventListener
    extends Object
    implements org.springframework.context.ApplicationContextAware
    An entity listener that creates a new PlatformEvent on PrePersist, PreUpdate and PreRemove. Also, a PlatformEvent can be created manually by calling createEvent(PlatformEvent.Type, String).
    Note that this listener is able to work in two scenarios. The first is as a regular Spring bean that can be invoked from other beans. As a JPA entity listener, we use a static reference to the current ApplicationContext to retrieve an instance of the EntityManager in use.
    Author:
    Matthias Müller
    • Constructor Detail

      • PlatformEventListener

        public PlatformEventListener()
    • Method Detail

      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
                                   throws org.springframework.beans.BeansException
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
        Throws:
        org.springframework.beans.BeansException
      • beforeCreate

        public void beforeCreate​(Auditable<?> o)
      • onUpdate

        public void onUpdate​(Auditable<?> o)
      • onDelete

        public void onDelete​(Auditable<?> o)
      • createEvent

        public void createEvent​(PlatformEvent.Type type,
                                String message,
                                javax.servlet.http.HttpServletRequest request)
      • setAuditUser

        public void setAuditUser​(String auditUser)
      • setAuditApplication

        public void setAuditApplication​(String auditApplication)
      • setPersist

        public void setPersist​(boolean persist)