[英]Akka Config - application.conf - Setting Dispatcher & Router
[英]Akka doesn't load application.conf
我正在嘗試設置不同的akka.http.parsing.max-chunk-size
我的 application.conf 在 src/resources/ 中,如下所示:
akka.http {
parsing {
max-chunk-size=20m
}
}
我在主程序中使用此代碼來設置我的系統:
val conf = ConfigFactory.load()
implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()
implicit val executionContext = system.dispatcher
但是,在嘗試發出大的 get 請求時,我仍然收到此錯誤:
akka.http.scaladsl.model.EntityStreamException: HTTP chunk size exceeds the configured limit of 1048576 bytes
編輯:我嘗試根據我得到的答案重新定位文件,但是我仍然遇到相同的錯誤。 我的程序結構是這樣的:
├── main
│ ├── resources
│ │ └── application.conf
│ └── scala
│ ├── program
│ │ ├── BackTester.scala
│ │ ├── Main.scala
│ │ └── StrategyExecutor.scala
│ ├── strategies
│ │ ├── BollingerBandStrategy.scala
│ │ ├── CrossingSMAStrategy.scala
│ │ ├── RSIStrategy.scala
│ │ ├── StochasticStrategy.scala
│ │ └── TradingStrategies.scala
│ └── util
│ ├── Interval.scala
│ ├── JsonParser.scala
│ ├── Time.scala
│ ├── barseries
│ │ └── barSeriesBuilder.scala
│ └── requests
│ └── Fetcher.scala
└── test
└── scala
我查看了官網,看起來配置是正確的( https://doc.akka.io/docs/akka-http/current/configuration.html )。 我會將一個特定的應用程序放入 application.conf 文件中。 就像下面的這個例子。
routersDemo {
akka {
actor.deployment {
/poolMaster2 {
router = round-robin-pool
nr-of-instances = 5
}
/groupMaster2 {
router = round-robin-group
routees {
paths = ["/user/slave_1","/user/slave_2","/user/slave_3","/user/slave_4","/user/slave_5"]
}
}
}
}
}
然后在 ConfigFactory 中調用它
val system = ActorSystem("routersDemo", ConfigFactory.load().getConfig("routersDemo"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.