Class DefaultBufferingAuditService

java.lang.Object
com.atlassian.jira.auditing.DefaultBufferingAuditService
All Implemented Interfaces:
BufferingAuditService

@ParametersAreNonnullByDefault public class DefaultBufferingAuditService extends Object implements BufferingAuditService
A wrapper for AuditService that provides buffering capabilities during Jira start-up. The implementation of this class allows to process audit events from the components that AuditService implementation depends on. It allows to avoid circular dependencies and to audit events very early in the Jira start-up cycle by buffering incoming events until it receives ComponentManagerStartedEvent notification. After that notification is received, the accumulated queue of events will be flushed and all subsequent events will be audited directly. Please be aware that the timestamps of the events that were deferred will not match the actual time they occurred.
Since:
v8.9
  • Constructor Details

    • DefaultBufferingAuditService

      public DefaultBufferingAuditService(com.atlassian.event.api.EventPublisher eventPublisher)
  • Method Details

    • onComponentManagerStartedEvent

      @EventListener public void onComponentManagerStartedEvent(ComponentManagerStartedEvent ignore)
    • auditOrPutToQueue

      public void auditOrPutToQueue(Supplier<com.atlassian.audit.entity.AuditEvent> eventSupplier)
      Will buffer event suppliers without calling them until ComponentManagerStartedEvent is received, signalling that Jira has finished its start-up. After that notification is received, it will always forward calls to AuditService directly. If the capacity of the queue is exceeded, the exception will be logged but not thrown.
      Specified by:
      auditOrPutToQueue in interface BufferingAuditService
      Parameters:
      eventSupplier - - event supplier that will not be called until ComponentManagerStartedEvent is received