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

java.lang.Object
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
Асинхронный обработчик событий.
  • 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)