# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

pekko {
    # Loggers to register at boot time (pekko.event.Logging$DefaultLogger logs
    # to STDOUT)
    loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]

    # Log level used by the configured loggers (see "loggers") as soon
    # as they have been started; before that, see "stdout-loglevel"
    # Options: OFF, ERROR, WARNING, INFO, DEBUG
    loglevel = "INFO"
    loglevel = ${?TEXERA_SERVICE_LOG_LEVEL}

    # Log level for the very basic logger activated during ActorSystem startup.
    # This logger prints the log messages to stdout (System.out).
    # Options: OFF, ERROR, WARNING, INFO, DEBUG
    stdout-loglevel = "INFO"

    # Filter of log events that is used by the LoggingAdapter before
    # publishing log events to the eventStream.
    logging-filter = "org.apache.pekko.event.slf4j.Slf4jLoggingFilter"

    actor {
        provider = cluster
        enable-additional-serialization-bindings = on
        allow-java-serialization = off
        serializers {
            kryo = "io.altoo.serialization.kryo.pekko.PekkoKryoSerializer"
        }
        serialization-bindings {
            "java.io.Serializable" = kryo
            "java.lang.Throwable" = pekko-misc
        }
    }

    remote {
        artery {
            transport = tcp
            canonical.hostname = "0.0.0.0"
            canonical.port = 0
            advanced.maximum-frame-size = 30 MiB
            advanced.maximum-large-frame-size = 120 MiB
        }
    }
    cluster {
        seed-nodes = []

        # auto downing is NOT safe for production deployments.
        # you may want to use it during development, read more about it in the docs.
        auto-down-unreachable-after = off
        downing-provider-class = "org.apache.pekko.cluster.sbr.SplitBrainResolverProvider"
        unreachable-nodes-reaper-interval = 5s
        gossip-interval = 10s
        leader-actions-interval = 10s
        gossip-time-to-live = 20s

        failure-detector {
            heartbeat-interval = 10s
            acceptable-heartbeat-pause = 50s
            expected-response-after = 30s
        }
    }
}

pekko-kryo-serialization.kryo-initializer = "org.apache.texera.amber.engine.common.AmberKryoInitializer"
