diff --git a/akka-docs/scala/camel.rst b/akka-docs/scala/camel.rst index 5475eb0a27..b3fc5e5f2a 100644 --- a/akka-docs/scala/camel.rst +++ b/akka-docs/scala/camel.rst @@ -63,7 +63,8 @@ component`_), only the actor's endpointUri method must be changed. Actors can also trigger message exchanges with external systems i.e. produce to Camel endpoints. -.. includecode:: code/akka/docs/camel/Introduction.scala#Producer +.. includecode:: code/akka/docs/camel/Introduction.scala + :include: imports,Producer In the above example, any message sent to this actor will be added (produced) to the example JMS queue. Producer actors may choose from the same set of Camel diff --git a/akka-docs/scala/code/akka/docs/camel/Introduction.scala b/akka-docs/scala/code/akka/docs/camel/Introduction.scala index 12a29ef72c..38546c9f41 100644 --- a/akka-docs/scala/code/akka/docs/camel/Introduction.scala +++ b/akka-docs/scala/code/akka/docs/camel/Introduction.scala @@ -1,44 +1,48 @@ package akka.docs.camel -import akka.actor._ -import akka.camel._ +object wrapper { + { + //#Consumer-mina + import akka.camel.{ CamelMessage, Consumer } -//#Consumer-mina -import akka.actor.Actor -import akka.actor.Actor._ -import akka.camel.{CamelMessage, Consumer} + class MyActor extends Consumer { + def endpointUri = "mina:tcp://localhost:6200?textline=true" -class MyActor extends Consumer { - def endpointUri = "mina:tcp://localhost:6200?textline=true" + def receive = { + case msg: CamelMessage ⇒ { /* ... */ } + case _ ⇒ { /* ... */ } + } + } - def receive = { - case msg: CamelMessage => { /* ... */} - case _ => { /* ... */} + // start and expose actor via tcp + import akka.actor.{ ActorSystem, Props } + + val sys = ActorSystem("camel") + val myActor = sys.actorOf(Props[MyActor]) + //#Consumer-mina } -} + { + //#Consumer + import akka.camel.{ CamelMessage, Consumer } -// start and expose actor via tcp -val sys = ActorSystem("camel") -val myActor = sys.actorOf(Props[MyActor]) -//#Consumer-mina + class MyActor extends Consumer { + def endpointUri = "jetty:http://localhost:8877/example" - -//#Consumer -class MyActor extends Consumer { - def endpointUri = "jetty:http://localhost:8877/example" - - def receive = { - case msg: CamelMessage => { /* ... */} - case _ => { /* ... */} + def receive = { + case msg: CamelMessage ⇒ { /* ... */ } + case _ ⇒ { /* ... */ } + } + } + //#Consumer } -} -//#Consumer + { + //#Producer + import akka.actor.Actor + import akka.camel.{ Producer, Oneway } -//#Producer -import akka.actor.Actor -import akka.camel.{Producer, Oneway} - -class MyActor extends Actor with Producer with Oneway { - def endpointUri = "jms:queue:example" -} -//#Producer \ No newline at end of file + class MyActor extends Actor with Producer with Oneway { + def endpointUri = "jms:queue:example" + } + //#Producer + } +} \ No newline at end of file diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala index c21ca76d73..bf08b73438 100644 --- a/project/AkkaBuild.scala +++ b/project/AkkaBuild.scala @@ -320,7 +320,7 @@ object AkkaBuild extends Build { id = "akka-docs", base = file("akka-docs"), dependencies = Seq(actor, testkit % "test->test", remote, cluster, slf4j, agent, transactor, - fileMailbox, mongoMailbox, redisMailbox, beanstalkMailbox, zookeeperMailbox, zeroMQ), + fileMailbox, mongoMailbox, redisMailbox, beanstalkMailbox, zookeeperMailbox, zeroMQ, camel), settings = defaultSettings ++ Seq( unmanagedSourceDirectories in Test <<= baseDirectory { _ ** "code" get }, libraryDependencies ++= Dependencies.docs,