Class WanReplicationHandler

java.lang.Object
com.loomcache.server.wan.WanReplicationHandler

public class WanReplicationHandler extends Object
Protocol handler for WAN replication messages over the binary protocol.

Handles the following message types:

  • WAN_SYNC — Exchange Merkle trees and enqueue delta sync to a target cluster
  • WAN_BATCH — Receive a batch of replication events
  • WAN_ACK — Process acknowledgment from a remote publisher
  • WAN_STATUS — Query replication statistics
  • WAN_PAUSE — Pause replication to a target
  • WAN_RESUME — Resume replication to a target

Message Format:

  • mapName — target cluster ID for PAUSE/RESUME/STATUS, source cluster ID for BATCH/ACK
  • value — serialized batch payload (WAN_BATCH), ack sequence (WAN_ACK)
  • key — endpoint address for WAN_SYNC
Since:
2.0
  • Constructor Details

    • WanReplicationHandler

      public WanReplicationHandler(@NonNull WanReplicationManager manager, int instanceNumber)
      Create a WAN replication handler.
      Parameters:
      manager - the WAN replication manager
      instanceNumber - the node instance number for logging
  • Method Details

    • handle

      public @Nullable Message handle(@NonNull Message msg)
      Handle a WAN replication protocol message.
      Parameters:
      msg - the incoming message
      Returns:
      a response message, or null if the message type is not a WAN operation
    • isWanOperation

      public static boolean isWanOperation(@Nullable MessageType type)
      Check whether a message type is a WAN replication operation.
      Parameters:
      type - the message type to check
      Returns:
      true if the type is a WAN operation