Package ru.bitel.bgbilling.kernel.event

# Class AsyncEventWorker<E extends ru.bitel.bgbilling.kernel.event.common.Event>

java.lang.Object
ru.bitel.bgbilling.kernel.base.server.logger.BGLogger
ru.bitel.common.worker.WorkerTask<EventListenerContext>
ru.bitel.bgbilling.kernel.event.EventWorker
ru.bitel.bgbilling.kernel.event.AsyncEventWorker<E>

Type Parameters:
  `E` -

All Implemented Interfaces:
  `Runnable`, `EventListener<ru.bitel.bgbilling.kernel.event.common.Event>`

Direct Known Subclasses:
  `OrderManagerDeviceWorker`, `ServiceActivatorDeviceWorker`

public abstract class AsyncEventWorker<E extends ru.bitel.bgbilling.kernel.event.common.Event> extends EventWorker
Асинхронный обработчик событий.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class ru.bitel.common.worker.WorkerTask

  `ru.bitel.common.worker.WorkerTask.BlockingExecutionHandler`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected long`
  `batchPause`
  `protected int`
  `batchSize`
  `protected long`
  `errorCount`
  `protected final boolean`
  `needAcknowledge`
  `protected long`
  `waitNextTask`

  ### Fields inherited from class ru.bitel.bgbilling.kernel.event.EventWorker

  `batchWait, consumer, errorPause, moduleId, working`

  ### Fields inherited from class ru.bitel.common.worker.WorkerTask

  `context`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AsyncEventWorker(EventProcessor ep, Class<? extends ru.bitel.bgbilling.kernel.event.common.Event> clazz, int moduleId, int pluginId, String query)`
  `AsyncEventWorker(EventProcessor ep, String destination, int moduleId, int pluginId, String query, boolean autoAcknowledge, Class<?>... clazz)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `doTasks()`
  Выполнение задач (одной или нескольких, с ожиданием новых в течении `EventWorker.batchWait`), нужно вызывать из `EventWorker.runWorker()`.
  `protected boolean`
  `internalDoTask(Object task)`
  `void`
  `notify(ru.bitel.bgbilling.kernel.event.common.Event task, EventListenerContext ctx)`
  `protected Object`
  `poll(long timeout)`
  `protected void`
  `processDoTaskException(Object task, boolean inDoTask, boolean putFirstIfInDoTask, ru.bitel.bgbilling.common.BGException ex, boolean throwException)`
  `protected void`
  `putFirst(Object task)`
  `protected void`
  `putLast(Object task)`
  `protected abstract void`
  `taskDone(Object task, Object result)`
  `protected void`
  `taskTimeout(Object task)`

  ### Methods inherited from class ru.bitel.bgbilling.kernel.event.EventWorker

  `doTask, internalRunWorker, pollFirstTask, runImpl, runWorker, setConsumer, shutdown`

  ### Methods inherited from class ru.bitel.common.worker.WorkerTask

  `newBlockingFixedThreadPool, newFixedThreadPool, newFixedThreadPool, newScheduledThreadPool, run, runSync, runSync, setContext`

  ### Methods inherited from class ru.bitel.bgbilling.kernel.base.server.logger.BGLogger

  `error, error, error, getLogger, logError, logError, warn`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### waitNextTask

    protected long waitNextTask

  - ### batchSize

    protected int batchSize

  - ### batchPause

    protected long batchPause

  - ### needAcknowledge

    protected final boolean needAcknowledge

  - ### errorCount

    protected long errorCount

- ## Constructor Details

  - ### AsyncEventWorker

    public AsyncEventWorker(EventProcessor ep, Class<? extends ru.bitel.bgbilling.kernel.event.common.Event> clazz, int moduleId, int pluginId, String query) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### AsyncEventWorker

    public AsyncEventWorker(EventProcessor ep, String destination, int moduleId, int pluginId, String query, boolean autoAcknowledge, Class<?>... clazz) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

- ## Method Details

  - ### poll

    protected Object poll(long timeout) throws ru.bitel.bgbilling.common.BGException
    Overrides:
      `poll` in class `EventWorker`
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### putFirst

    protected void putFirst(Object task) throws InterruptedException
    Throws:
      `InterruptedException`

  - ### putLast

    protected void putLast(Object task) throws InterruptedException
    Throws:
      `InterruptedException`

  - ### doTasks

    public boolean doTasks() throws ru.bitel.bgbilling.common.BGException
    Description copied from class: `EventWorker`
    Выполнение задач (одной или нескольких, с ожиданием новых в течении `EventWorker.batchWait`), нужно вызывать из `EventWorker.runWorker()`.
    Overrides:
      `doTasks` in class `EventWorker`
    Returns:
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### internalDoTask

    protected boolean internalDoTask(Object task) throws javax.jms.JMSException, jakarta.xml.bind.JAXBException, ru.bitel.bgbilling.common.BGException
    Overrides:
      `internalDoTask` in class `EventWorker`
    Throws:
      `javax.jms.JMSException`
      `jakarta.xml.bind.JAXBException`
      `ru.bitel.bgbilling.common.BGException`

  - ### notify

    public void notify(ru.bitel.bgbilling.kernel.event.common.Event task, EventListenerContext ctx) throws ru.bitel.bgbilling.common.BGException
    Specified by:
      `notify` in interface `EventListener<E extends ru.bitel.bgbilling.kernel.event.common.Event>`
    Overrides:
      `notify` in class `EventWorker`
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### processDoTaskException

    protected void processDoTaskException(Object task, boolean inDoTask, boolean putFirstIfInDoTask, ru.bitel.bgbilling.common.BGException ex, boolean throwException) throws ru.bitel.bgbilling.common.BGException
    Parameters:
      `task` -
      `inDoTask` - ошибка произошла в doTask или позже
      `putFirstIfInDoTask` -
      `ex` -
      `throwException` -
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### taskDone

    protected abstract void taskDone(Object task, Object result) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### taskTimeout

    protected void taskTimeout(Object task)