AsyncEventQueueFactory (Apache Geode 2.0.2)
Description: declaration: package: org.apache.geode.cache.asyncqueue, interface: AsyncEventQueueFactory

Package org.apache.geode.cache.asyncqueue

# Interface AsyncEventQueueFactory

public interface AsyncEventQueueFactory
Factory to create the `AsyncEventQueue`. Below example illustrates how to get the instance of factory and create the `AsyncEventQueue`.

      Cache c = new CacheFactory().create();
      // get AsyncEventQueueFactory from cache
      AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();

      // set the attributes on factory
      factory.setBatchSize(batchSize);
      factory.setBatchConflationEnabled(isConflation);
      factory.setMaximumQueueMemory(maxMemory);
      factory.setParallel(isParallel);
                 .
                 .
      // create instance of AsyncEventListener
      AsyncEventListener asyncEventListener = new <AsyncEventListener class>;
      // create AsyncEventQueue by providing the id and instance of AsyncEventListener
      AsyncEventQueue asyncQueue = factory.create(asyncQueueId, asyncEventListener);

Since:
  GemFire 7.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AsyncEventQueueFactory`
  `addGatewayEventFilter(GatewayEventFilter filter)`
  Adds a `GatewayEventFilter` to the attributes of AsyncEventQueue being created by factory.
  `AsyncEventQueue`
  `create(String id, AsyncEventListener listener)`
  Creates the `AsyncEventQueue`.
  `AsyncEventQueueFactory`
  `pauseEventDispatching()`
  Pauses the dispatching of the queued events to the listener.
  `AsyncEventQueueFactory`
  `removeGatewayEventFilter(GatewayEventFilter filter)`
  Removes the provided `GatewayEventFilter` from the attributes of AsyncEventQueue being created by factory.
  `AsyncEventQueueFactory`
  `setBatchConflationEnabled(boolean isConflation)`
  Sets whether to enable batch conflation for `AsyncEventQueue`.
  `AsyncEventQueueFactory`
  `setBatchSize(int size)`
  Sets the batch size for an `AsyncEventQueue`'s queue.
  `AsyncEventQueueFactory`
  `setBatchTimeInterval(int interval)`
  Sets the batch time interval (in milliseconds) for a `AsyncEventQueue`.
  `AsyncEventQueueFactory`
  `setDiskStoreName(String name)`
  Sets the disk store name for overflow or persistence.
  `AsyncEventQueueFactory`
  `setDiskSynchronous(boolean isSynchronous)`
  Sets whether or not the writing to the disk is synchronous.
  `AsyncEventQueueFactory`
  `setDispatcherThreads(int numThreads)`
  Sets the number of dispatcher threads.
  `AsyncEventQueueFactory`
  `setForwardExpirationDestroy(boolean forward)`
  Forwards destroy operations from expiration action to AsyncEventQueue.
  `AsyncEventQueueFactory`
  `setGatewayEventSubstitutionListener(GatewayEventSubstitutionFilter filter)`
  Sets the `GatewayEventSubstitutionFilter`.
  `AsyncEventQueueFactory`
  `setMaximumQueueMemory(int memory)`
  Sets the maximum amount of memory (in MB) for an `AsyncEventQueue`'s queue.
  `AsyncEventQueueFactory`
  `setOrderPolicy(GatewaySender.OrderPolicy policy)`
  Sets the order policy for multiple dispatchers.
  `AsyncEventQueueFactory`
  `setParallel(boolean isParallel)`
  Indicates whether all VMs need to distribute events to remote site.
  `AsyncEventQueueFactory`
  `setPersistent(boolean isPersistent)`
  Sets whether the `AsyncEventQueue` is persistent or not.

- ## Method Details

  - ### setDiskStoreName

    AsyncEventQueueFactory setDiskStoreName(String name)
    Sets the disk store name for overflow or persistence.
    Parameters:
      `name` - the disk store name for overflow or persistence
    Returns:
      this factory

  - ### setMaximumQueueMemory

    AsyncEventQueueFactory setMaximumQueueMemory(int memory)
    Sets the maximum amount of memory (in MB) for an `AsyncEventQueue`'s queue. Default is 100 MB.
    Parameters:
      `memory` - The maximum amount of memory (in MB) for an `AsyncEventQueue`'s queue
    Returns:
      this factory

  - ### setDiskSynchronous

    AsyncEventQueueFactory setDiskSynchronous(boolean isSynchronous)
    Sets whether or not the writing to the disk is synchronous. Default is true.
    Parameters:
      `isSynchronous` - boolean if true indicates synchronous writes
    Returns:
      this factory

  - ### setBatchSize

    AsyncEventQueueFactory setBatchSize(int size)
    Sets the batch size for an `AsyncEventQueue`'s queue. Default is 100.
    Parameters:
      `size` - The size of batches sent to its `AsyncEventListener`
    Returns:
      this factory

  - ### setBatchTimeInterval

    AsyncEventQueueFactory setBatchTimeInterval(int interval)
    Sets the batch time interval (in milliseconds) for a `AsyncEventQueue`. Default is 5 ms.
    Parameters:
      `interval` - The maximum time interval that can elapse before a partial batch is sent from a `AsyncEventQueue`.
    Returns:
      this factory

  - ### setPersistent

    AsyncEventQueueFactory setPersistent(boolean isPersistent)
    Sets whether the `AsyncEventQueue` is persistent or not. Default is false.
    Parameters:
      `isPersistent` - Whether to enable persistence for an `AsyncEventQueue`.
    Returns:
      this factory

  - ### setParallel

    AsyncEventQueueFactory setParallel(boolean isParallel)
    Indicates whether all VMs need to distribute events to remote site. In this case only the events originating in a particular VM will be in dispatched in order. Default is false.
    Parameters:
      `isParallel` - boolean to indicate whether distribution policy is parallel
    Returns:
      this factory

  - ### setBatchConflationEnabled

    AsyncEventQueueFactory setBatchConflationEnabled(boolean isConflation)
    Sets whether to enable batch conflation for `AsyncEventQueue`. Default is false.
    Parameters:
      `isConflation` - Whether or not to enable batch conflation for batches sent from a `AsyncEventQueue`
    Returns:
      this factory

  - ### setDispatcherThreads

    AsyncEventQueueFactory setDispatcherThreads(int numThreads)
    Sets the number of dispatcher threads. Default is 5.
    Parameters:
      `numThreads` - the number of dispatcher threads
    Returns:
      this factory

  - ### addGatewayEventFilter

    AsyncEventQueueFactory addGatewayEventFilter(GatewayEventFilter filter)
    Adds a `GatewayEventFilter` to the attributes of AsyncEventQueue being created by factory.
    Parameters:
      `filter` - GatewayEventFilter
    Returns:
      this factory

  - ### removeGatewayEventFilter

    AsyncEventQueueFactory removeGatewayEventFilter(GatewayEventFilter filter)
    Removes the provided `GatewayEventFilter` from the attributes of AsyncEventQueue being created by factory.
    Parameters:
      `filter` - the `GatewayEventFilter` to remove
    Returns:
      this factory

  - ### setOrderPolicy

    AsyncEventQueueFactory setOrderPolicy(GatewaySender.OrderPolicy policy)
    Sets the order policy for multiple dispatchers. Default is KEY.
    Parameters:
      `policy` - the order policy for multiple dispatchers
    Returns:
      this factory

  - ### setGatewayEventSubstitutionListener

    AsyncEventQueueFactory setGatewayEventSubstitutionListener(GatewayEventSubstitutionFilter filter)
    Sets the `GatewayEventSubstitutionFilter`.
    Parameters:
      `filter` - The `GatewayEventSubstitutionFilter`
    Returns:
      this factory

  - ### setForwardExpirationDestroy

    AsyncEventQueueFactory setForwardExpirationDestroy(boolean forward)
    Forwards destroy operations from expiration action to AsyncEventQueue. By default the expiration destroy events are not added to AEQ, by setting this attribute to true adds destroy event to AEQ.
    Parameters:
      `forward` - boolean to indicate whether to forward expiration destroy events.
    Returns:
      this factory

  - ### pauseEventDispatching

    AsyncEventQueueFactory pauseEventDispatching()
    Pauses the dispatching of the queued events to the listener.
    Returns:
      this factory

  - ### create

    AsyncEventQueue create(String id, AsyncEventListener listener)
    Creates the `AsyncEventQueue`. It accepts Id of AsyncEventQueue and instance of AsyncEventListener. Multiple queues can be created using Same listener instance. So, the instance of `AsyncEventListener` should be thread safe in that case. The `AsyncEventListener` will start receiving events when the `AsyncEventQueue` is created.
    Parameters:
      `id` - Id of AsyncEventQueue
      `listener` - `AsyncEventListener` to be added to the regions that are configured to use this queue.
    Returns:
      the created `AsyncEventQueue`