Dropped service package and moved contained classes one level up.
This commit is contained in:
parent
06ac8de617
commit
2c558e33d9
10 changed files with 16 additions and 21 deletions
|
|
@ -107,7 +107,7 @@ trait CamelContextLifecycle extends Logging {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a global CamelContext and ProducerTemplate accessible to applications. The lifecycle
|
* Makes a global CamelContext and ProducerTemplate accessible to applications. The lifecycle
|
||||||
* of these objects is managed by se.scalablesolutions.akka.camel.service.CamelService.
|
* of these objects is managed by se.scalablesolutions.akka.camel.CamelService.
|
||||||
*/
|
*/
|
||||||
object CamelContextManager extends CamelContextLifecycle {
|
object CamelContextManager extends CamelContextLifecycle {
|
||||||
override def context: CamelContext = super.context
|
override def context: CamelContext = super.context
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,10 @@
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.scalablesolutions.akka.camel.service
|
package se.scalablesolutions.akka.camel
|
||||||
|
|
||||||
import se.scalablesolutions.akka.actor.Actor._
|
import se.scalablesolutions.akka.actor.Actor._
|
||||||
import se.scalablesolutions.akka.actor.{AspectInitRegistry, ActorRegistry}
|
import se.scalablesolutions.akka.actor.{AspectInitRegistry, ActorRegistry}
|
||||||
import se.scalablesolutions.akka.camel.CamelContextManager
|
|
||||||
import se.scalablesolutions.akka.util.{Bootable, Logging}
|
import se.scalablesolutions.akka.util.{Bootable, Logging}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package se.scalablesolutions.akka.camel.service
|
package se.scalablesolutions.akka.camel
|
||||||
|
|
||||||
import collection.mutable.ListBuffer
|
import collection.mutable.ListBuffer
|
||||||
|
|
||||||
|
|
@ -13,7 +13,6 @@ import org.apache.camel.builder.RouteBuilder
|
||||||
|
|
||||||
import se.scalablesolutions.akka.actor._
|
import se.scalablesolutions.akka.actor._
|
||||||
import se.scalablesolutions.akka.actor.annotation.consume
|
import se.scalablesolutions.akka.actor.annotation.consume
|
||||||
import se.scalablesolutions.akka.camel.{Consumer, CamelContextManager}
|
|
||||||
import se.scalablesolutions.akka.camel.component.ActiveObjectComponent
|
import se.scalablesolutions.akka.camel.component.ActiveObjectComponent
|
||||||
import se.scalablesolutions.akka.util.Logging
|
import se.scalablesolutions.akka.util.Logging
|
||||||
|
|
||||||
|
|
@ -42,7 +41,7 @@ class ConsumerPublisher extends Actor with Logging {
|
||||||
latch.countDown // needed for testing only.
|
latch.countDown // needed for testing only.
|
||||||
}
|
}
|
||||||
case d: ConsumerMethodRegistered => {
|
case d: ConsumerMethodRegistered => {
|
||||||
handleConsumerMethodDetected(d)
|
handleConsumerMethodRegistered(d)
|
||||||
latch.countDown // needed for testing only.
|
latch.countDown // needed for testing only.
|
||||||
}
|
}
|
||||||
case SetExpectedMessageCount(num) => {
|
case SetExpectedMessageCount(num) => {
|
||||||
|
|
@ -69,11 +68,11 @@ class ConsumerPublisher extends Actor with Logging {
|
||||||
log.info("unpublished actor %s (%s) from endpoint %s" format (event.clazz, event.id, event.uri))
|
log.info("unpublished actor %s (%s) from endpoint %s" format (event.clazz, event.id, event.uri))
|
||||||
}
|
}
|
||||||
|
|
||||||
private def handleConsumerMethodDetected(event: ConsumerMethodRegistered) {
|
private def handleConsumerMethodRegistered(event: ConsumerMethodRegistered) {
|
||||||
// using the actor uuid is highly experimental
|
// using the actor uuid is highly experimental
|
||||||
val objectId = event.init.actorRef.uuid
|
|
||||||
val targetClass = event.init.target.getName
|
val targetClass = event.init.target.getName
|
||||||
val targetMethod = event.method.getName
|
val targetMethod = event.method.getName
|
||||||
|
val objectId = "%s_%s" format (event.init.actorRef.uuid, targetMethod)
|
||||||
|
|
||||||
CamelContextManager.activeObjectRegistry.put(objectId, event.activeObject)
|
CamelContextManager.activeObjectRegistry.put(objectId, event.activeObject)
|
||||||
CamelContextManager.context.addRoutes(new ConsumerMethodRoute(event.uri, objectId, targetMethod))
|
CamelContextManager.context.addRoutes(new ConsumerMethodRoute(event.uri, objectId, targetMethod))
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package se.scalablesolutions.akka.camel.service
|
package se.scalablesolutions.akka.camel
|
||||||
|
|
||||||
import java.util.concurrent.{CountDownLatch, TimeUnit}
|
import java.util.concurrent.{CountDownLatch, TimeUnit}
|
||||||
|
|
||||||
|
|
@ -7,7 +7,6 @@ import org.scalatest.{GivenWhenThen, BeforeAndAfterAll, FeatureSpec}
|
||||||
|
|
||||||
import se.scalablesolutions.akka.actor.Actor._
|
import se.scalablesolutions.akka.actor.Actor._
|
||||||
import se.scalablesolutions.akka.actor.{Actor, ActorRegistry}
|
import se.scalablesolutions.akka.actor.{Actor, ActorRegistry}
|
||||||
import se.scalablesolutions.akka.camel.{CamelContextManager, Message, Consumer}
|
|
||||||
|
|
||||||
class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with GivenWhenThen {
|
class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with GivenWhenThen {
|
||||||
import CamelServiceFeatureTest._
|
import CamelServiceFeatureTest._
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package se.scalablesolutions.akka.camel.service
|
package se.scalablesolutions.akka.camel
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.scalatest.junit.JUnitSuite
|
import org.scalatest.junit.JUnitSuite
|
||||||
|
|
@ -6,7 +6,6 @@ import org.scalatest.junit.JUnitSuite
|
||||||
import se.scalablesolutions.akka.actor.Actor
|
import se.scalablesolutions.akka.actor.Actor
|
||||||
import se.scalablesolutions.akka.actor.Actor._
|
import se.scalablesolutions.akka.actor.Actor._
|
||||||
import se.scalablesolutions.akka.actor.annotation.consume
|
import se.scalablesolutions.akka.actor.annotation.consume
|
||||||
import se.scalablesolutions.akka.camel.Consumer
|
|
||||||
|
|
||||||
object ConsumerRegisteredTest {
|
object ConsumerRegisteredTest {
|
||||||
@consume("mock:test1")
|
@consume("mock:test1")
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
package se.scalablesolutions.akka.camel.service
|
package se.scalablesolutions.akka.camel
|
||||||
|
|
||||||
import java.util.concurrent.{CountDownLatch, TimeUnit}
|
import java.util.concurrent.{CountDownLatch, TimeUnit}
|
||||||
|
|
||||||
import org.junit.{Before, After, Test}
|
import org.junit.{Before, After, Test}
|
||||||
import org.scalatest.junit.JUnitSuite
|
import org.scalatest.junit.JUnitSuite
|
||||||
|
|
||||||
import se.scalablesolutions.akka.actor.{Actor, ActorRef, ActorRegistry, ActorRegistered, ActorUnregistered}
|
|
||||||
import se.scalablesolutions.akka.actor.Actor._
|
import se.scalablesolutions.akka.actor.Actor._
|
||||||
|
import se.scalablesolutions.akka.actor.{Actor, ActorRef, ActorRegistry, ActorRegistered, ActorUnregistered}
|
||||||
import se.scalablesolutions.akka.camel.Consumer
|
|
||||||
import se.scalablesolutions.akka.camel.support.{SetExpectedMessageCount => SetExpectedTestMessageCount, _}
|
import se.scalablesolutions.akka.camel.support.{SetExpectedMessageCount => SetExpectedTestMessageCount, _}
|
||||||
|
|
||||||
class PublishRequestorTest extends JUnitSuite {
|
class PublishRequestorTest extends JUnitSuite {
|
||||||
|
|
@ -6,7 +6,7 @@ package se.scalablesolutions.akka.servlet
|
||||||
|
|
||||||
import se.scalablesolutions.akka.remote.BootableRemoteActorService
|
import se.scalablesolutions.akka.remote.BootableRemoteActorService
|
||||||
import se.scalablesolutions.akka.actor.BootableActorLoaderService
|
import se.scalablesolutions.akka.actor.BootableActorLoaderService
|
||||||
import se.scalablesolutions.akka.camel.service.CamelService
|
import se.scalablesolutions.akka.camel.CamelService
|
||||||
import se.scalablesolutions.akka.config.Config
|
import se.scalablesolutions.akka.config.Config
|
||||||
import se.scalablesolutions.akka.util.{Logging, Bootable}
|
import se.scalablesolutions.akka.util.{Logging, Bootable}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ package se.scalablesolutions.akka.kernel
|
||||||
import se.scalablesolutions.akka.servlet.AkkaLoader
|
import se.scalablesolutions.akka.servlet.AkkaLoader
|
||||||
import se.scalablesolutions.akka.remote.BootableRemoteActorService
|
import se.scalablesolutions.akka.remote.BootableRemoteActorService
|
||||||
import se.scalablesolutions.akka.actor.BootableActorLoaderService
|
import se.scalablesolutions.akka.actor.BootableActorLoaderService
|
||||||
import se.scalablesolutions.akka.camel.service.CamelService
|
import se.scalablesolutions.akka.camel.CamelService
|
||||||
import se.scalablesolutions.akka.config.Config
|
import se.scalablesolutions.akka.config.Config
|
||||||
|
|
||||||
object Main {
|
object Main {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package sample.camel
|
package sample.camel
|
||||||
|
|
||||||
import se.scalablesolutions.akka.camel.service.CamelService
|
import se.scalablesolutions.akka.camel.CamelService
|
||||||
import se.scalablesolutions.akka.remote.RemoteNode
|
import se.scalablesolutions.akka.remote.RemoteNode
|
||||||
import se.scalablesolutions.akka.actor.Actor._
|
import se.scalablesolutions.akka.actor.Actor._
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ import org.apache.camel.spring.spi.ApplicationContextRegistry
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext
|
import org.springframework.context.support.ClassPathXmlApplicationContext
|
||||||
|
|
||||||
import se.scalablesolutions.akka.actor.Actor._
|
import se.scalablesolutions.akka.actor.Actor._
|
||||||
|
import se.scalablesolutions.akka.actor.{ActiveObject, SupervisorFactory}
|
||||||
import se.scalablesolutions.akka.camel.CamelContextManager
|
import se.scalablesolutions.akka.camel.CamelContextManager
|
||||||
import se.scalablesolutions.akka.config.ScalaConfig._
|
import se.scalablesolutions.akka.config.ScalaConfig._
|
||||||
import se.scalablesolutions.akka.actor.{ActiveObject, SupervisorFactory}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Martin Krasser
|
* @author Martin Krasser
|
||||||
|
|
@ -63,7 +63,8 @@ class Boot {
|
||||||
actorOf[Consumer4].start // POSTing "stop" to http://0.0.0.0:8877/camel/stop stops and unpublishes this actor
|
actorOf[Consumer4].start // POSTing "stop" to http://0.0.0.0:8877/camel/stop stops and unpublishes this actor
|
||||||
actorOf[Consumer5].start // POSTing any msg to http://0.0.0.0:8877/camel/start starts and published Consumer4 again.
|
actorOf[Consumer5].start // POSTing any msg to http://0.0.0.0:8877/camel/start starts and published Consumer4 again.
|
||||||
|
|
||||||
// Publish active object methods on endpoints
|
// Active object example
|
||||||
|
|
||||||
ActiveObject.newInstance(classOf[Consumer10])
|
ActiveObject.newInstance(classOf[Consumer10])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue