Move all doc examples out of the akka-package to avoid use of private APIs. See #2092
This commit is contained in:
parent
09469b73e1
commit
0eae9d8d22
85 changed files with 105 additions and 105 deletions
30
akka-docs/scala/code/docs/camel/Consumers.scala
Normal file
30
akka-docs/scala/code/docs/camel/Consumers.scala
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package docs.camel
|
||||
|
||||
object Consumers {
|
||||
{
|
||||
//#Consumer1
|
||||
import akka.camel.{ CamelMessage, Consumer }
|
||||
|
||||
class Consumer1 extends Consumer {
|
||||
def endpointUri = "file:data/input/actor"
|
||||
|
||||
def receive = {
|
||||
case msg: CamelMessage ⇒ println("received %s" format msg.bodyAs[String])
|
||||
}
|
||||
}
|
||||
//#Consumer1
|
||||
}
|
||||
{
|
||||
//#Consumer2
|
||||
import akka.camel.{ CamelMessage, Consumer }
|
||||
|
||||
class Consumer2 extends Consumer {
|
||||
def endpointUri = "jetty:http://localhost:8877/camel/default"
|
||||
|
||||
def receive = {
|
||||
case msg: CamelMessage ⇒ sender ! ("Hello %s" format msg.bodyAs[String])
|
||||
}
|
||||
}
|
||||
//#Consumer2
|
||||
}
|
||||
}
|
||||
54
akka-docs/scala/code/docs/camel/Introduction.scala
Normal file
54
akka-docs/scala/code/docs/camel/Introduction.scala
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package docs.camel
|
||||
|
||||
object Introduction {
|
||||
{
|
||||
//#Consumer-mina
|
||||
import akka.camel.{ CamelMessage, Consumer }
|
||||
|
||||
class MinaClient extends Consumer {
|
||||
def endpointUri = "mina:tcp://localhost:6200?textline=true"
|
||||
|
||||
def receive = {
|
||||
case msg: CamelMessage ⇒ { /* ... */ }
|
||||
case _ ⇒ { /* ... */ }
|
||||
}
|
||||
}
|
||||
|
||||
// start and expose actor via tcp
|
||||
import akka.actor.{ ActorSystem, Props }
|
||||
|
||||
val sys = ActorSystem("camel")
|
||||
val mina = sys.actorOf(Props[MinaClient])
|
||||
//#Consumer-mina
|
||||
}
|
||||
{
|
||||
//#Consumer
|
||||
import akka.camel.{ CamelMessage, Consumer }
|
||||
|
||||
class JettyAdapter extends Consumer {
|
||||
def endpointUri = "jetty:http://localhost:8877/example"
|
||||
|
||||
def receive = {
|
||||
case msg: CamelMessage ⇒ { /* ... */ }
|
||||
case _ ⇒ { /* ... */ }
|
||||
}
|
||||
}
|
||||
//#Consumer
|
||||
}
|
||||
{
|
||||
//#Producer
|
||||
import akka.actor.Actor
|
||||
import akka.camel.{ Producer, Oneway }
|
||||
import akka.actor.{ ActorSystem, Props }
|
||||
|
||||
class Orders extends Actor with Producer with Oneway {
|
||||
def endpointUri = "jms:queue:Orders"
|
||||
}
|
||||
|
||||
val sys = ActorSystem("camel")
|
||||
val orders = sys.actorOf(Props[Orders])
|
||||
|
||||
orders ! <order amount="100" currency="PLN" itemId="12345"/>
|
||||
//#Producer
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue