# SPDX-License-Identifier: Apache-2.0

#############################################
# Pekko Cluster Typed Reference Config File #
#############################################

# This is the reference config file that contains all the default settings.
# Make your edits/overrides in your application.conf.

pekko.cluster.typed.receptionist {
  # Updates with Distributed Data are done with this consistency level.
  # Possible values: local, majority, all, 2, 3, 4 (n)
  write-consistency = local

  # Period task to remove actor references that are hosted by removed nodes,
  # in case of abrupt termination.
  pruning-interval = 3 s

  # The periodic task to remove actor references that are hosted by removed nodes
  # will only remove entries older than this duration. The reason for this
  # is to avoid removing entries of nodes that haven't been visible as joining.
  prune-removed-older-than = 60 s

  # Shard the services over this many Distributed Data keys, with large amounts of different
  # service keys storing all of them in the same Distributed Data entry would lead to large updates
  # etc. instead the keys are sharded across this number of keys. This must be the same on all nodes
  # in a cluster, changing it requires a full cluster restart (stopping all nodes before starting them again)
  distributed-key-count = 5

  # Settings for the Distributed Data replicator used by Receptionist.
  # Same layout as pekko.cluster.distributed-data.
  distributed-data = ${pekko.cluster.distributed-data}
  # make sure that by default it's for all roles (Play loads config in different way)
  distributed-data.role = ""
}

pekko.cluster.ddata.typed {
  # The timeout to use for ask operations in ReplicatorMessageAdapter.
  # This should be longer than the timeout given in Replicator.WriteConsistency and
  # Replicator.ReadConsistency. The replicator will always send a reply within those
  # timeouts so the unexpected ask timeout should not occur, but for cleanup in a
  # failure situation it must still exist.
  # If askUpdate, askGet or askDelete takes longer then this timeout a
  # java.util.concurrent.TimeoutException will be thrown by the requesting actor and
  # may be handled by supervision.
  replicator-message-adapter-unexpected-ask-timeout = 20 s
}

pekko {
  actor {
    serialization-identifiers {
      "org.apache.pekko.cluster.typed.internal.PekkoClusterTypedSerializer" = 28
      "org.apache.pekko.cluster.typed.internal.delivery.ReliableDeliverySerializer" = 36
    }
    serializers {
      typed-cluster = "org.apache.pekko.cluster.typed.internal.PekkoClusterTypedSerializer"
      reliable-delivery = "org.apache.pekko.cluster.typed.internal.delivery.ReliableDeliverySerializer"
    }
    serialization-bindings {
      "org.apache.pekko.cluster.typed.internal.receptionist.ClusterReceptionist$Entry" = typed-cluster
      "org.apache.pekko.actor.typed.internal.pubsub.TopicImpl$MessagePublished" = typed-cluster
      "org.apache.pekko.actor.typed.delivery.internal.DeliverySerializable" = reliable-delivery
    }
  }
  cluster.configuration-compatibility-check.checkers {
    receptionist = "org.apache.pekko.cluster.typed.internal.receptionist.ClusterReceptionistConfigCompatChecker"
  }
}
