mirror of
https://github.com/lightbend/config.git
synced 2025-03-23 07:40:25 +08:00
add akka-reference.conf as a test case
This commit is contained in:
parent
0d4feca770
commit
b1b2403a5d
305
src/test/resources/test04.conf
Normal file
305
src/test/resources/test04.conf
Normal file
@ -0,0 +1,305 @@
|
||||
# This is an unmodified akka-reference.conf, except for this
|
||||
# comment and quoting one key that contained slashes.
|
||||
# Note: the outer akka{} would not be used in the usual setup
|
||||
# with this config lib.
|
||||
|
||||
##############################
|
||||
# Akka Reference Config File #
|
||||
##############################
|
||||
|
||||
# This the reference config file has all the default settings.
|
||||
# All these could be removed with no visible effect.
|
||||
# Modify as needed.
|
||||
# This file is imported in the 'akka.conf' file. Make your edits/overrides there.
|
||||
|
||||
akka {
|
||||
version = "2.0-SNAPSHOT" # Akka version, checked against the runtime version of Akka.
|
||||
|
||||
enabled-modules = [] # Comma separated list of the enabled modules. Options: ["cluster", "camel", "http"]
|
||||
|
||||
time-unit = "seconds" # Time unit for all timeout properties throughout the config
|
||||
|
||||
event-handlers = ["akka.event.Logging$DefaultLogger"] # Event handlers to register at boot time (Logging$DefaultLogger logs to STDOUT)
|
||||
loglevel = "WARNING" # Options: ERROR, WARNING, INFO, DEBUG
|
||||
# this level is used by the configured loggers (see "event-handlers") as soon
|
||||
# as they have been started; before that, see "stdout-loglevel"
|
||||
stdout-loglevel = "WARNING" # Loglevel for the very basic logger activated during AkkaApplication startup
|
||||
|
||||
event-handler-dispatcher {
|
||||
type = "Dispatcher" # Must be one of the following
|
||||
# Dispatcher, (BalancingDispatcher, only valid when all actors using it are of the same type),
|
||||
# A FQCN to a class inheriting MessageDispatcherConfigurator with a no-arg visible constructor
|
||||
name = "EventHandlerDispatcher" # Optional, will be a generated UUID if omitted
|
||||
keep-alive-time = 60 # Keep alive time for threads
|
||||
core-pool-size = 1 # No of core threads
|
||||
max-pool-size = 8 # Max no of threads
|
||||
executor-bounds = -1 # Makes the Executor bounded, -1 is unbounded
|
||||
task-queue-size = -1 # Specifies the bounded capacity of the task queue (< 1 == unbounded)
|
||||
task-queue-type = "linked" # Specifies which type of task queue will be used, can be "array" or "linked" (default)
|
||||
allow-core-timeout = on # Allow core threads to time out
|
||||
rejection-policy = "caller-runs" # abort, caller-runs, discard-oldest, discard
|
||||
throughput = 5 # Throughput for Dispatcher, set to 1 for complete fairness
|
||||
throughput-deadline-time = -1 # Throughput deadline for Dispatcher, set to 0 or negative for no deadline
|
||||
mailbox-capacity = -1 # If negative (or zero) then an unbounded mailbox is used (default)
|
||||
# If positive then a bounded mailbox is used and the capacity is set using the property
|
||||
# NOTE: setting a mailbox to 'blocking' can be a bit dangerous, could lead to deadlock, use with care
|
||||
# The following are only used for Dispatcher and only if mailbox-capacity > 0
|
||||
mailbox-push-timeout-time = 10 # Specifies the timeout to add a new message to a mailbox that is full - negative number means infinite timeout
|
||||
# (in unit defined by the time-unit property)
|
||||
}
|
||||
|
||||
# These boot classes are loaded (and created) automatically when the Akka Microkernel boots up
|
||||
# Can be used to bootstrap your application(s)
|
||||
# Should be the FQN (Fully Qualified Name) of the boot class which needs to have a default constructor
|
||||
# boot = ["sample.camel.Boot",
|
||||
# "sample.rest.java.Boot",
|
||||
# "sample.rest.scala.Boot",
|
||||
# "sample.security.Boot"]
|
||||
boot = []
|
||||
|
||||
actor {
|
||||
timeout = 5 # Default timeout for Future based invocations
|
||||
# - Actor: ask && ?
|
||||
# - UntypedActor: ask
|
||||
# - TypedActor: methods with non-void return type
|
||||
serialize-messages = off # Does a deep clone of (non-primitive) messages to ensure immutability
|
||||
throughput = 5 # Default throughput for all Dispatcher, set to 1 for complete fairness
|
||||
throughput-deadline-time = -1 # Default throughput deadline for all Dispatcher, set to 0 or negative for no deadline
|
||||
dispatcher-shutdown-timeout = 1 # Using the akka.time-unit, how long dispatchers by default will wait for new actors until they shut down
|
||||
|
||||
deployment {
|
||||
|
||||
"/app/service-ping" { # deployment id pattern
|
||||
|
||||
router = "round-robin" # routing (load-balance) scheme to use
|
||||
# available: "direct", "round-robin", "random", "scatter-gather"
|
||||
# "least-cpu", "least-ram", "least-messages"
|
||||
# or: fully qualified class name of the router class
|
||||
# default is "direct";
|
||||
# if 'replication' is used then the only available router is "direct"
|
||||
|
||||
nr-of-instances = 3 # number of actor instances in the cluster
|
||||
# available: positive integer (1-N) or the string "auto" for auto-scaling
|
||||
# default is '1'
|
||||
# if the "direct" router is used then this element is ignored (always '1')
|
||||
|
||||
#create-as {
|
||||
# class = "com.biz.app.MyActor" # FIXME document 'create-as'
|
||||
#}
|
||||
|
||||
remote {
|
||||
nodes = ["wallace:2552", "gromit:2552"] # A list of hostnames and ports for instantiating the remote actor instances
|
||||
# The format should be on "hostname:port", where:
|
||||
# - hostname can be either hostname or IP address the remote actor should connect to
|
||||
# - port should be the port for the remote server on the other node
|
||||
}
|
||||
|
||||
#cluster { # defines the actor as a clustered actor
|
||||
# default (if omitted) is local non-clustered actor
|
||||
|
||||
# preferred-nodes = ["node:node1"] # a list of preferred nodes for instantiating the actor instances on
|
||||
# defined as node name
|
||||
# available: "node:<node name>"
|
||||
|
||||
|
||||
# replication { # use replication or not? only makes sense for a stateful actor
|
||||
|
||||
# FIXME should we have this config option here? If so, implement it all through.
|
||||
# serialize-mailbox = off # should the actor mailbox be part of the serialized snapshot?
|
||||
# default is 'off'
|
||||
|
||||
# storage = "transaction-log" # storage model for replication
|
||||
# available: "transaction-log" and "data-grid"
|
||||
# default is "transaction-log"
|
||||
|
||||
# strategy = "write-through" # guaranteees for replication
|
||||
# available: "write-through" and "write-behind"
|
||||
# default is "write-through"
|
||||
|
||||
# }
|
||||
#}
|
||||
}
|
||||
}
|
||||
|
||||
default-dispatcher {
|
||||
type = "Dispatcher" # Must be one of the following
|
||||
# Dispatcher, (BalancingDispatcher, only valid when all actors using it are of the same type),
|
||||
# A FQCN to a class inheriting MessageDispatcherConfigurator with a no-arg visible constructor
|
||||
name = "MyDispatcher" # Optional, will be a generated UUID if omitted
|
||||
keep-alive-time = 60 # Keep alive time for threads
|
||||
core-pool-size-factor = 8.0 # No of core threads ... ceil(available processors * factor)
|
||||
max-pool-size-factor = 8.0 # Max no of threads ... ceil(available processors * factor)
|
||||
executor-bounds = -1 # Makes the Executor bounded, -1 is unbounded
|
||||
task-queue-size = -1 # Specifies the bounded capacity of the task queue (< 1 == unbounded)
|
||||
task-queue-type = "linked" # Specifies which type of task queue will be used, can be "array" or "linked" (default)
|
||||
allow-core-timeout = on # Allow core threads to time out
|
||||
rejection-policy = "caller-runs" # abort, caller-runs, discard-oldest, discard
|
||||
throughput = 5 # Throughput for Dispatcher, set to 1 for complete fairness
|
||||
throughput-deadline-time = -1 # Throughput deadline for Dispatcher, set to 0 or negative for no deadline
|
||||
mailbox-capacity = -1 # If negative (or zero) then an unbounded mailbox is used (default)
|
||||
# If positive then a bounded mailbox is used and the capacity is set using the property
|
||||
# NOTE: setting a mailbox to 'blocking' can be a bit dangerous, could lead to deadlock, use with care
|
||||
# The following are only used for Dispatcher and only if mailbox-capacity > 0
|
||||
mailbox-push-timeout-time = 10 # Specifies the timeout to add a new message to a mailbox that is full - negative number means infinite timeout
|
||||
# (in unit defined by the time-unit property)
|
||||
}
|
||||
|
||||
debug {
|
||||
receive = off # enable function of Actor.loggable(), which is to log any received message at DEBUG level
|
||||
autoreceive = off # enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill and the like)
|
||||
lifecycle = off # enable DEBUG logging of actor lifecycle changes
|
||||
}
|
||||
|
||||
mailbox {
|
||||
|
||||
file-based {
|
||||
directory-path = "./_mb"
|
||||
max-items = 2147483647
|
||||
max-size = 2147483647
|
||||
max-items = 2147483647
|
||||
max-age = 0
|
||||
max-journal-size = 16777216 # 16 * 1024 * 1024
|
||||
max-memory-size = 134217728 # 128 * 1024 * 1024
|
||||
max-journal-overflow = 10
|
||||
max-journal-size-absolute = 9223372036854775807
|
||||
discard-old-when-full = on
|
||||
keep-journal = on
|
||||
sync-journal = off
|
||||
}
|
||||
|
||||
redis {
|
||||
hostname = "127.0.0.1"
|
||||
port = 6379
|
||||
}
|
||||
|
||||
mongodb {
|
||||
# Any specified collection name will be used as a prefix for collections that use durable mongo mailboxes
|
||||
uri = "mongodb://localhost/akka.mailbox" # Follow Mongo URI Spec - http://www.mongodb.org/display/DOCS/Connections
|
||||
|
||||
# Configurable timeouts for certain ops
|
||||
timeout {
|
||||
read = 3000 # number of milliseconds to wait for a read to succeed before timing out the future
|
||||
write = 3000 # number of milliseconds to wait for a write to succeed before timing out the future
|
||||
}
|
||||
}
|
||||
|
||||
zookeeper {
|
||||
server-addresses = "localhost:2181"
|
||||
session-timeout = 60
|
||||
connection-timeout = 60
|
||||
blocking-queue = on
|
||||
}
|
||||
|
||||
beanstalk {
|
||||
hostname = "127.0.0.1"
|
||||
port = 11300
|
||||
reconnect-window = 5
|
||||
message-submit-delay = 0
|
||||
message-submit-timeout = 5
|
||||
message-time-to-live = 120
|
||||
}
|
||||
}
|
||||
|
||||
# Entries for pluggable serializers and their bindings. If a binding for a specific class is not found,
|
||||
# then the default serializer (Java serialization) is used.
|
||||
#
|
||||
# serializers {
|
||||
# java = "akka.serialization.JavaSerializer"
|
||||
# proto = "akka.testing.ProtobufSerializer"
|
||||
# sjson = "akka.testing.SJSONSerializer"
|
||||
# default = "akka.serialization.JavaSerializer"
|
||||
# }
|
||||
|
||||
# serialization-bindings {
|
||||
# java = ["akka.serialization.SerializeSpec$Address",
|
||||
# "akka.serialization.MyJavaSerializableActor",
|
||||
# "akka.serialization.MyStatelessActorWithMessagesInMailbox",
|
||||
# "akka.serialization.MyActorWithProtobufMessagesInMailbox"]
|
||||
# sjson = ["akka.serialization.SerializeSpec$Person"]
|
||||
# proto = ["com.google.protobuf.Message",
|
||||
# "akka.actor.ProtobufProtocol$MyMessage"]
|
||||
# }
|
||||
}
|
||||
|
||||
remote {
|
||||
# FIXME rename to transport
|
||||
layer = "akka.cluster.netty.NettyRemoteSupport"
|
||||
|
||||
secure-cookie = "" # Generate your own with '$AKKA_HOME/scripts/generate_config_with_secure_cookie.sh'
|
||||
# or using 'akka.util.Crypt.generateSecureCookie'
|
||||
|
||||
remote-daemon-ack-timeout = 30 # Timeout for ACK of cluster operations, lik checking actor out etc.
|
||||
|
||||
use-passive-connections = on # Reuse inbound connections for outbound messages
|
||||
|
||||
failure-detector { # accrual failure detection config
|
||||
threshold = 8 # defines the failure detector threshold
|
||||
# A low threshold is prone to generate many wrong suspicions but ensures a
|
||||
# quick detection in the event of a real crash. Conversely, a high threshold
|
||||
# generates fewer mistakes but needs more time to detect actual crashes
|
||||
max-sample-size = 1000
|
||||
}
|
||||
|
||||
server {
|
||||
port = 2552 # The default remote server port clients should connect to. Default is 2552 (AKKA)
|
||||
message-frame-size = 1048576 # Increase this if you want to be able to send messages with large payloads
|
||||
connection-timeout = 120 # Length in time-unit
|
||||
require-cookie = off # Should the remote server require that it peers share the same secure-cookie (defined in the 'remote' section)?
|
||||
untrusted-mode = off # Enable untrusted mode for full security of server managed actors, allows untrusted clients to connect.
|
||||
backlog = 4096 # Sets the size of the connection backlog
|
||||
}
|
||||
|
||||
client {
|
||||
buffering {
|
||||
retry-message-send-on-failure = false # Should message buffering on remote client error be used (buffer flushed on successful reconnect)
|
||||
capacity = -1 # If negative (or zero) then an unbounded mailbox is used (default)
|
||||
# If positive then a bounded mailbox is used and the capacity is set using the property
|
||||
}
|
||||
reconnect-delay = 5
|
||||
read-timeout = 3600
|
||||
message-frame-size = 1048576
|
||||
reap-futures-delay = 5
|
||||
reconnection-time-window = 600 # Maximum time window that a client should try to reconnect for
|
||||
}
|
||||
}
|
||||
|
||||
cluster {
|
||||
name = "test-cluster"
|
||||
zookeeper-server-addresses = "localhost:2181" # comma-separated list of '<hostname>:<port>' elements
|
||||
max-time-to-wait-until-connected = 30
|
||||
session-timeout = 60
|
||||
connection-timeout = 60
|
||||
include-ref-node-in-replica-set = on # Can a replica be instantiated on the same node as the cluster reference to the actor
|
||||
# Default: on
|
||||
log-directory = "_akka_cluster" # Where ZooKeeper should store the logs and data files
|
||||
|
||||
replication {
|
||||
digest-type = "MAC" # Options: CRC32 (cheap & unsafe), MAC (expensive & secure using password)
|
||||
password = "secret" # FIXME: store open in file?
|
||||
ensemble-size = 3
|
||||
quorum-size = 2
|
||||
snapshot-frequency = 1000 # The number of messages that should be logged between every actor snapshot
|
||||
timeout = 30 # Timeout for asyncronous (write-behind) operations
|
||||
}
|
||||
}
|
||||
|
||||
stm {
|
||||
fair = on # Should global transactions be fair or non-fair (non fair yield better performance)
|
||||
max-retries = 1000
|
||||
timeout = 5 # Default timeout for blocking transactions and transaction set (in unit defined by
|
||||
# the time-unit property)
|
||||
write-skew = true
|
||||
blocking-allowed = false
|
||||
interruptible = false
|
||||
speculative = true
|
||||
quick-release = true
|
||||
propagation = "requires"
|
||||
trace-level = "none"
|
||||
}
|
||||
|
||||
test {
|
||||
timefactor = "1.0" # factor by which to scale timeouts during tests, e.g. to account for shared build system load
|
||||
filter-leeway = 3 # time-units EventFilter.intercept waits after the block is finished until all required messages are received
|
||||
single-expect-default = 3 # time-units to wait in expectMsg and friends outside of within() block by default
|
||||
}
|
||||
}
|
@ -652,4 +652,19 @@ class ConfigTest extends TestUtils {
|
||||
// equiv01/original.json was included (it has a slash in the name)
|
||||
assertEquals("a", conf.getString("equiv01.strings.a"))
|
||||
}
|
||||
|
||||
@Test
|
||||
def test04LoadAkkaReference() {
|
||||
val conf = Config.load("test04")
|
||||
|
||||
// Note, test04 is an unmodified old-style akka.conf,
|
||||
// which means it has an outer akka{} namespace.
|
||||
// that namespace wouldn't normally be used with
|
||||
// this library because the conf object is not global,
|
||||
// it's per-module already.
|
||||
assertEquals("2.0-SNAPSHOT", conf.getString("akka.version"))
|
||||
assertEquals(8, conf.getInt("akka.event-handler-dispatcher.max-pool-size"))
|
||||
assertEquals("round-robin", conf.getString("akka.actor.deployment.\"/app/service-ping\".router"))
|
||||
assertEquals(true, conf.getBoolean("akka.stm.quick-release"))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user