2014-10-18 57 views
0

我有一个Akka actor来扩展camel的UntypedConsumerActor。我想在application.conf中提供其端点URI的值,而不是硬编码,因为在开发,测试和生产环境中,URI将有所不同。我喜欢用纯粹的类型安全配置来做到这一点,并且不必在Spring中接线。一个示例application.conf会很棒。akka-camel:在application.conf中设置URI端点?

回答

0

您可以像阅读从UntypedConsumerActor配置属性的东西:

this.uri = getContext().system().settings().config().getString("myendpoint-uri"); 

,并在您application.conf定义:

myendpoint-uri = "mina2:tcp://localhost:6200?textline=true" 
+0

太好了!不如DI好,但现在工作。 Akka何时有自己的DI? :-) – 2014-10-23 15:25:08

+0

你可能想从配置中获取uri并将其传递给actor的构造函数。阻止演员取决于配置 – gvd 2015-01-04 03:07:24