Capitalizing Camel Settings constants.

This commit is contained in:
Viktor Klang 2012-09-27 12:11:45 +02:00
parent 4441b03e07
commit 6ff5eb711f
7 changed files with 21 additions and 21 deletions

View file

@ -61,33 +61,33 @@ class CamelSettings private[camel] (config: Config, dynamicAccess: DynamicAccess
/** /**
* Configured setting for how long the actor should wait for activation before it fails. * Configured setting for how long the actor should wait for activation before it fails.
*/ */
final val activationTimeout: FiniteDuration = Duration(config.getMilliseconds("akka.camel.consumer.activation-timeout"), MILLISECONDS) final val ActivationTimeout: FiniteDuration = Duration(config.getMilliseconds("akka.camel.consumer.activation-timeout"), MILLISECONDS)
/** /**
* Configured setting, when endpoint is out-capable (can produce responses) replyTimeout is the maximum time * Configured setting, when endpoint is out-capable (can produce responses) replyTimeout is the maximum time
* the endpoint can take to send the response before the message exchange fails. * the endpoint can take to send the response before the message exchange fails.
* This setting is used for out-capable, in-only, manually acknowledged communication. * This setting is used for out-capable, in-only, manually acknowledged communication.
*/ */
final val replyTimeout: FiniteDuration = Duration(config.getMilliseconds("akka.camel.consumer.reply-timeout"), MILLISECONDS) final val ReplyTimeout: FiniteDuration = Duration(config.getMilliseconds("akka.camel.consumer.reply-timeout"), MILLISECONDS)
/** /**
* Configured setting which determines whether one-way communications between an endpoint and this consumer actor * Configured setting which determines whether one-way communications between an endpoint and this consumer actor
* should be auto-acknowledged or application-acknowledged. * should be auto-acknowledged or application-acknowledged.
* This flag has only effect when exchange is in-only. * This flag has only effect when exchange is in-only.
*/ */
final val autoAck: Boolean = config.getBoolean("akka.camel.consumer.auto-ack") final val AutoAck: Boolean = config.getBoolean("akka.camel.consumer.auto-ack")
/** /**
* *
*/ */
final val jmxStatistics: Boolean = config.getBoolean("akka.camel.jmx") final val JmxStatistics: Boolean = config.getBoolean("akka.camel.jmx")
/** /**
* enables or disables streamingCache on the Camel Context * enables or disables streamingCache on the Camel Context
*/ */
final val streamingCache: Boolean = config.getBoolean("akka.camel.streamingCache") final val StreamingCache: Boolean = config.getBoolean("akka.camel.streamingCache")
final val conversions: (String, RouteDefinition) RouteDefinition = { final val Conversions: (String, RouteDefinition) RouteDefinition = {
import scala.collection.JavaConverters.asScalaSetConverter import scala.collection.JavaConverters.asScalaSetConverter
val specifiedConversions = { val specifiedConversions = {
val section = config.getConfig("akka.camel.conversions") val section = config.getConfig("akka.camel.conversions")

View file

@ -42,21 +42,21 @@ trait Consumer extends Actor with CamelSupport {
/** /**
* How long the actor should wait for activation before it fails. * How long the actor should wait for activation before it fails.
*/ */
def activationTimeout: FiniteDuration = camel.settings.activationTimeout def activationTimeout: FiniteDuration = camel.settings.ActivationTimeout
/** /**
* When endpoint is out-capable (can produce responses) replyTimeout is the maximum time * When endpoint is out-capable (can produce responses) replyTimeout is the maximum time
* the endpoint can take to send the response before the message exchange fails. It defaults to 1 minute. * the endpoint can take to send the response before the message exchange fails. It defaults to 1 minute.
* This setting is used for out-capable, in-only, manually acknowledged communication. * This setting is used for out-capable, in-only, manually acknowledged communication.
*/ */
def replyTimeout: FiniteDuration = camel.settings.replyTimeout def replyTimeout: FiniteDuration = camel.settings.ReplyTimeout
/** /**
* Determines whether one-way communications between an endpoint and this consumer actor * Determines whether one-way communications between an endpoint and this consumer actor
* should be auto-acknowledged or application-acknowledged. * should be auto-acknowledged or application-acknowledged.
* This flag has only effect when exchange is in-only. * This flag has only effect when exchange is in-only.
*/ */
def autoAck: Boolean = camel.settings.autoAck def autoAck: Boolean = camel.settings.AutoAck
/** /**
* Returns the route definition handler for creating a custom route to this consumer. * Returns the route definition handler for creating a custom route to this consumer.

View file

@ -24,7 +24,7 @@ private[camel] class ConsumerActorRouteBuilder(endpointUri: String, consumer: Ac
def configure(): Unit = def configure(): Unit =
applyUserRouteCustomization( applyUserRouteCustomization(
settings.conversions.apply( settings.Conversions.apply(
endpointUri take endpointUri.indexOf(":"), // e.g. "http" from "http://whatever/..." endpointUri take endpointUri.indexOf(":"), // e.g. "http" from "http://whatever/..."
from(endpointUri).routeId(consumer.path.toString))).to(targetActorUri) from(endpointUri).routeId(consumer.path.toString))).to(targetActorUri)

View file

@ -35,9 +35,9 @@ private[camel] class DefaultCamel(val system: ExtendedActorSystem) extends Camel
lazy val context: DefaultCamelContext = { lazy val context: DefaultCamelContext = {
val ctx = new DefaultCamelContext val ctx = new DefaultCamelContext
if (!settings.jmxStatistics) ctx.disableJMX() if (!settings.JmxStatistics) ctx.disableJMX()
ctx.setName(system.name) ctx.setName(system.name)
ctx.setStreamCaching(settings.streamingCache) ctx.setStreamCaching(settings.StreamingCache)
ctx.addComponent("akka", new ActorComponent(this, system)) ctx.addComponent("akka", new ActorComponent(this, system))
ctx.getTypeConverterRegistry.addTypeConverter(classOf[FiniteDuration], classOf[String], DurationTypeConverter) ctx.getTypeConverterRegistry.addTypeConverter(classOf[FiniteDuration], classOf[String], DurationTypeConverter)
ctx ctx

View file

@ -95,9 +95,9 @@ private[camel] trait ActorEndpointConfig {
def path: ActorEndpointPath def path: ActorEndpointPath
def camel: Camel def camel: Camel
@BeanProperty var replyTimeout: FiniteDuration = camel.settings.replyTimeout @BeanProperty var replyTimeout: FiniteDuration = camel.settings.ReplyTimeout
@BeanProperty var autoAck: Boolean = camel.settings.autoAck @BeanProperty var autoAck: Boolean = camel.settings.AutoAck
} }
/** /**
@ -135,7 +135,7 @@ private[camel] class ActorProducer(val endpoint: ActorEndpoint, camel: Camel) ex
private[camel] def processExchangeAdapter(exchange: CamelExchangeAdapter): Unit = { private[camel] def processExchangeAdapter(exchange: CamelExchangeAdapter): Unit = {
val isDone = new CountDownLatch(1) val isDone = new CountDownLatch(1)
processExchangeAdapter(exchange, new AsyncCallback { def done(doneSync: Boolean) { isDone.countDown() } }) processExchangeAdapter(exchange, new AsyncCallback { def done(doneSync: Boolean) { isDone.countDown() } })
isDone.await(camel.settings.replyTimeout.toMillis, TimeUnit.MILLISECONDS) isDone.await(camel.settings.ReplyTimeout.toMillis, TimeUnit.MILLISECONDS)
} }
/** /**

View file

@ -19,23 +19,23 @@ class CamelConfigSpec extends WordSpec with MustMatchers {
} }
"CamelConfigSpec" must { "CamelConfigSpec" must {
"have correct activationTimeout config" in { "have correct activationTimeout config" in {
settings.activationTimeout must be === Duration(config.getMilliseconds("akka.camel.consumer.activation-timeout"), MILLISECONDS) settings.ActivationTimeout must be === Duration(config.getMilliseconds("akka.camel.consumer.activation-timeout"), MILLISECONDS)
} }
"have correct autoAck config" in { "have correct autoAck config" in {
settings.autoAck must be === config.getBoolean("akka.camel.consumer.auto-ack") settings.AutoAck must be === config.getBoolean("akka.camel.consumer.auto-ack")
} }
"have correct replyTimeout config" in { "have correct replyTimeout config" in {
settings.replyTimeout must be === Duration(config.getMilliseconds("akka.camel.consumer.reply-timeout"), MILLISECONDS) settings.ReplyTimeout must be === Duration(config.getMilliseconds("akka.camel.consumer.reply-timeout"), MILLISECONDS)
} }
"have correct streamingCache config" in { "have correct streamingCache config" in {
settings.streamingCache must be === config.getBoolean("akka.camel.streamingCache") settings.StreamingCache must be === config.getBoolean("akka.camel.streamingCache")
} }
"have correct jmxStatistics config" in { "have correct jmxStatistics config" in {
settings.jmxStatistics must be === config.getBoolean("akka.camel.jmx") settings.JmxStatistics must be === config.getBoolean("akka.camel.jmx")
} }
"have correct body conversions config" in { "have correct body conversions config" in {

View file

@ -92,7 +92,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpec with
verify(exchange, never()).setResponse(any[CamelMessage]) verify(exchange, never()).setResponse(any[CamelMessage])
info("no response forwarded to exchange") info("no response forwarded to exchange")
intercept[TimeoutException] { intercept[TimeoutException] {
Await.ready(future, camel.settings.replyTimeout - (1 seconds)) Await.ready(future, camel.settings.ReplyTimeout - (1 seconds))
} }
} }
} }