ru.bitel.bgbilling.kernel.event

## Class AsyncEventWorker<E extends Event>

- java.lang.Object
- - ru.bitel.common.worker.WorkerTask<EventListenerContext>
  - - ru.bitel.bgbilling.kernel.event.EventWorker
    - - ru.bitel.bgbilling.kernel.event.AsyncEventWorker<E>

- All Implemented Interfaces:
    java.lang.Runnable, EventListener<Event>
  Direct Known Subclasses:
    OrderManagerDeviceWorker, ServiceActivatorDeviceWorker

      public abstract class AsyncEventWorker<E extends Event>
      extends EventWorker

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `batchPause`
    `protected int` | `batchSize`
    `protected long` | `errorCount`
    `protected 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 and Description
    `AsyncEventWorker(EventProcessor ep, java.lang.Class<? extends Event> clazz, int moduleId, int pluginId, java.lang.String query)`
    `AsyncEventWorker(EventProcessor ep, java.lang.String destination, int moduleId, int pluginId, java.lang.String query, boolean autoAcknowledge, java.lang.Class<?>... clazz)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `doTasks()`
    `protected boolean` | `internalDoTask(java.lang.Object task)`
    `void` | `notify(Event task, EventListenerContext ctx)`
    `protected java.lang.Object` | `poll(long timeout)`
    `protected void` | `processDoTaskException(java.lang.Object task, boolean inDoTask, boolean putFirstIfInDoTask, ru.bitel.bgbilling.common.BGException ex, boolean throwException)`
    `protected void` | `putFirst(java.lang.Object task)`
    `protected void` | `putLast(java.lang.Object task)`
    `protected abstract void` | `taskDone(java.lang.Object task, java.lang.Object result)`

    - ### 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 java.lang.Object

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

- - ### Field Detail

    - #### waitNextTask

          protected long waitNextTask

    - #### batchSize

          protected int batchSize

    - #### batchPause

          protected long batchPause

    - #### needAcknowledge

          protected final boolean needAcknowledge

    - #### errorCount

          protected long errorCount

  - ### Constructor Detail

    - #### AsyncEventWorker

          public AsyncEventWorker(EventProcessor ep,
                                  java.lang.Class<? extends Event> clazz,
                                  int moduleId,
                                  int pluginId,
                                  java.lang.String query)
                           throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### AsyncEventWorker

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

      Throws:
        `ru.bitel.bgbilling.common.BGException`

  - ### Method Detail

    - #### poll

          protected java.lang.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(java.lang.Object task)
                           throws java.lang.InterruptedException

      Throws:
        `java.lang.InterruptedException`

    - #### putLast

          protected void putLast(java.lang.Object task)
                          throws java.lang.InterruptedException

      Throws:
        `java.lang.InterruptedException`

    - #### doTasks

          public boolean doTasks()
                          throws ru.bitel.bgbilling.common.BGException

      Overrides:
        `doTasks` in class `EventWorker`
      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### internalDoTask

          protected boolean internalDoTask(java.lang.Object task)
                                    throws javax.jms.JMSException,
                                           javax.xml.bind.JAXBException,
                                           ru.bitel.bgbilling.common.BGException

      Overrides:
        `internalDoTask` in class `EventWorker`
      Throws:
        `javax.jms.JMSException`
        `javax.xml.bind.JAXBException`
        `ru.bitel.bgbilling.common.BGException`

    - #### notify

          public void notify(Event task,
                             EventListenerContext ctx)
                      throws ru.bitel.bgbilling.common.BGException

      Specified by:
        `notify` in interface `EventListener<Event>`
      Overrides:
        `notify` in class `EventWorker`
      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### processDoTaskException

          protected void processDoTaskException(java.lang.Object task,
                                                boolean inDoTask,
                                                boolean putFirstIfInDoTask,
                                                ru.bitel.bgbilling.common.BGException ex,
                                                boolean throwException)
                                         throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### taskDone

          protected abstract void taskDone(java.lang.Object task,
                                           java.lang.Object result)
                                    throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`