Configuring Highly Available Gateway Queues

You can configure the gateway queues to persist data to disk similar to the way you persist replicated regions.

Persisting your gateway queues provides high availability for your messaging. If a gateway hub with persistence enabled exits for any reason, when the hub is restarted it automatically reloads the queue and resumes sending messages. The queue is persisted to the disk store specified in the gateway queue's disk-store-name.
Note: Persisted gateway queues are treated by GemFire like persistent replicated regions.

When you enable persistence on a gateway queue, the maximum-queue-memory attribute determines how much memory the queue can consume before overflowing to disk. By default, this value is set to 100MB.

Note: If you are using multiple concurrent gateway queues, the values defined in maximum-queue-memory and disk-store-name attribute apply to each queue. In the example below, each queue will use diskStoreA for persistence/overflow and each queue will have a maximum queue memory of 100MB. If you have 10 concurrent queues, then the total maximum memory for the overall gateway is 1000MB.
Persist your gateway queues using one of these methods:
  • XML:
    <gateway-queue disk-store-name="diskStoreA" enable-persistence="true" maximum-queue-memory="100"/>
  • API:
    Gateway gateway = hub.addGateway("US"); 
    GatewayQueueAttributes queueAttributes = gateway.getQueueAttributes(); 
    queueAttributes.setDiskStoreName("diskStoreA");
    queueAttributes.setEnablePersistence(true);
    queueAttributes.setMaximumQueueMemory(100); 

In addition, to achieve real high availability of your multi-site system, you should also configure primary and secondary gateway hubs. This configuration is described in Configuring Load Balancing for a Multi-site (WAN) System.