Conflating Events in a Queue

Conflating a queue improves distribution performance. When conflation is enabled, only the latest queued value is sent for a particular key.

Note: Do not use conflation if your receiving applications depend on the specific ordering of entry modifications, or if they need to be notified of every change to an entry.

Conflation is most useful when a single entry is updated frequently, but other sites only need to know the current value of the entry (rather than the value of each update). When an update is added to a queue that has conflation enabled, if there is already an update message in the queue for the entry key, then the existing message assumes the value of the new update and the new update is dropped, as shown here for key A.

Note: This method of conflation is different from the one used for server-to-client subscription queue conflation and peer-to-peer distribution within a distributed system.

Examples—Configuring Conflation for a Gateway Sender Queue

To enable conflation for a gateway sender queue, use one of the following mechanisms:

  • cache.xml configuration

      <gateway-sender id="NY" parallel="true" 
  • Java API configuration

    Cache cache = new CacheFactory().create();
    GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
    GatewaySender sender = gateway.create("NY", "1");

    Entry updates in the current, in-process batch are not eligible for conflation.

  • gfsh:

    gfsh>create gateway-sender --id="NY" --parallel=true 

The following examples show how to configure conflation for an asynchronous event queue:

  • cache.xml configuration

       <async-event-queue id="sampleQueue" persistent="true"
        disk-store-name="async-disk-store" parallel="false"
             <parameter name="url"> 
             <parameter name="username"> 
             <parameter name="password"> 
  • Java API configuration

    Cache cache = new CacheFactory().create();
    AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
    AsyncEventListener listener = new MyAsyncEventListener();
    AsyncEventQueue sampleQueue = factory.create("customerWB", listener);

    Entry updates in the current, in-process batch are not eligible for conflation.

  • gfsh:

    gfsh>create async-event-queue --id="sampleQueue" --persistent=true 
    --disk-store="async-disk-store" --parallel="false"