mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:07:02 +00:00
feature/Improve Pekko find available port
This commit is contained in:
parent
45538d0393
commit
4dda540f38
@ -7,7 +7,14 @@ import code.util.Helper
|
||||
object ObpActorConfig {
|
||||
|
||||
val localHostname = "127.0.0.1"
|
||||
def localPort = Helper.findAvailablePort()
|
||||
def localPort = {
|
||||
val systemPort = APIUtil.getPropsAsIntValue("pekko.remote.artery.canonical.port", 0)
|
||||
if (systemPort == 0) {
|
||||
Helper.findAvailablePort()
|
||||
} else {
|
||||
systemPort
|
||||
}
|
||||
}
|
||||
|
||||
val akka_loglevel = APIUtil.getPropsValue("remotedata.loglevel").openOr("INFO")
|
||||
|
||||
@ -64,12 +71,16 @@ object ObpActorConfig {
|
||||
}
|
||||
}
|
||||
remote {
|
||||
enabled-transports = ["org.apache.pekko.remote.netty.tcp"]
|
||||
netty {
|
||||
tcp {
|
||||
send-buffer-size = 50000000
|
||||
receive-buffer-size = 50000000
|
||||
maximum-frame-size = 52428800
|
||||
artery {
|
||||
transport = tcp
|
||||
canonical.hostname = """ + localHostname + """
|
||||
canonical.port = 0
|
||||
bind.hostname = """ + localHostname + """
|
||||
bind.port = 0
|
||||
advanced {
|
||||
maximum-frame-size = 52428800
|
||||
buffer-pool-size = 128
|
||||
maximum-large-frame-size = 52428800
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,8 +91,12 @@ object ObpActorConfig {
|
||||
s"""
|
||||
${commonConf}
|
||||
pekko {
|
||||
remote.netty.tcp.hostname = ${localHostname}
|
||||
remote.netty.tcp.port = 0
|
||||
remote.artery {
|
||||
canonical.hostname = ${localHostname}
|
||||
canonical.port = 0
|
||||
bind.hostname = ${localHostname}
|
||||
bind.port = 0
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@ -89,8 +104,12 @@ object ObpActorConfig {
|
||||
s"""
|
||||
${commonConf}
|
||||
pekko {
|
||||
remote.netty.tcp.hostname = ${localHostname}
|
||||
remote.netty.tcp.port = ${localPort}
|
||||
remote.artery {
|
||||
canonical.hostname = ${localHostname}
|
||||
canonical.port = ${localPort}
|
||||
bind.hostname = ${localHostname}
|
||||
bind.port = ${localPort}
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
@ -67,12 +67,16 @@ object AkkaConnectorActorConfig {
|
||||
}
|
||||
}
|
||||
remote {
|
||||
enabled-transports = ["org.apache.pekko.remote.netty.tcp"]
|
||||
netty {
|
||||
tcp {
|
||||
send-buffer-size = 50000000
|
||||
receive-buffer-size = 50000000
|
||||
maximum-frame-size = 52428800
|
||||
artery {
|
||||
transport = tcp
|
||||
canonical.hostname = "127.0.0.1"
|
||||
canonical.port = 0
|
||||
bind.hostname = "127.0.0.1"
|
||||
bind.port = 0
|
||||
advanced {
|
||||
maximum-frame-size = 52428800
|
||||
buffer-pool-size = 128
|
||||
maximum-large-frame-size = 52428800
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,8 +87,12 @@ object AkkaConnectorActorConfig {
|
||||
s"""
|
||||
${commonConf}
|
||||
pekko {
|
||||
remote.netty.tcp.hostname = ${localHostname}
|
||||
remote.netty.tcp.port = 0
|
||||
remote.artery {
|
||||
canonical.hostname = ${localHostname}
|
||||
canonical.port = 0
|
||||
bind.hostname = ${localHostname}
|
||||
bind.port = 0
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@ -92,8 +100,12 @@ object AkkaConnectorActorConfig {
|
||||
s"""
|
||||
${commonConf}
|
||||
pekko {
|
||||
remote.netty.tcp.hostname = ${localHostname}
|
||||
remote.netty.tcp.port = ${localPort}
|
||||
remote.artery {
|
||||
canonical.hostname = ${localHostname}
|
||||
canonical.port = ${localPort}
|
||||
bind.hostname = ${localHostname}
|
||||
bind.port = ${localPort}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@ -101,8 +113,12 @@ object AkkaConnectorActorConfig {
|
||||
s"""
|
||||
${commonConf}
|
||||
pekko {
|
||||
remote.netty.tcp.hostname = ${remoteHostname}
|
||||
remote.netty.tcp.port = ${remotePort}
|
||||
remote.artery {
|
||||
canonical.hostname = ${remoteHostname}
|
||||
canonical.port = ${remotePort}
|
||||
bind.hostname = ${remoteHostname}
|
||||
bind.port = ${remotePort}
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
@ -60,6 +60,11 @@ trait ServerSetup extends FeatureSpec with SendServerRequests
|
||||
setPropsValues("berlin_group_mandatory_headers" -> "")
|
||||
setPropsValues("berlin_group_mandatory_header_consent" -> "")
|
||||
|
||||
// Set system properties to force Pekko to use random available ports
|
||||
// This prevents conflicts when both RunWebApp and tests are running
|
||||
System.setProperty("pekko.remote.artery.canonical.port", "0")
|
||||
System.setProperty("pekko.remote.artery.bind.port", "0")
|
||||
|
||||
val server = TestServer
|
||||
def baseRequest = host(server.host, server.port)
|
||||
val secured = APIUtil.getPropsAsBoolValue("external.https", false)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user