2012-09-03 12:08:46 +02:00
|
|
|
/**
|
2013-01-09 01:47:48 +01:00
|
|
|
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
|
2012-09-03 12:08:46 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package akka.camel.internal
|
|
|
|
|
|
2012-09-26 17:12:30 +02:00
|
|
|
import akka.actor._
|
2012-09-03 12:08:46 +02:00
|
|
|
import akka.camel._
|
2012-09-26 17:12:30 +02:00
|
|
|
import akka.camel.internal.component.CamelPath
|
2012-09-03 12:08:46 +02:00
|
|
|
import org.apache.camel.builder.RouteBuilder
|
|
|
|
|
import org.apache.camel.model.RouteDefinition
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* For internal use only.
|
|
|
|
|
* Builder of a route to a target which can be an actor.
|
|
|
|
|
*
|
|
|
|
|
* @param endpointUri endpoint URI of the consumer actor.
|
|
|
|
|
*
|
2012-11-24 18:08:34 +01:00
|
|
|
*
|
2012-09-03 12:08:46 +02:00
|
|
|
*/
|
2012-09-26 17:12:30 +02:00
|
|
|
private[camel] class ConsumerActorRouteBuilder(endpointUri: String, consumer: ActorRef, config: ConsumerConfig, settings: CamelSettings) extends RouteBuilder {
|
2012-09-03 12:08:46 +02:00
|
|
|
|
|
|
|
|
protected def targetActorUri = CamelPath.toUri(consumer, config.autoAck, config.replyTimeout)
|
|
|
|
|
|
2012-09-26 17:12:30 +02:00
|
|
|
def configure(): Unit =
|
|
|
|
|
applyUserRouteCustomization(
|
2012-09-27 12:11:45 +02:00
|
|
|
settings.Conversions.apply(
|
2012-09-26 17:12:30 +02:00
|
|
|
endpointUri take endpointUri.indexOf(":"), // e.g. "http" from "http://whatever/..."
|
|
|
|
|
from(endpointUri).routeId(consumer.path.toString))).to(targetActorUri)
|
2012-09-03 12:08:46 +02:00
|
|
|
|
|
|
|
|
def applyUserRouteCustomization(rd: RouteDefinition) = config.onRouteDefinition(rd)
|
|
|
|
|
}
|