diff --git a/akka-camel/src/main/scala/CamelContextLifecycle.scala b/akka-camel/src/main/scala/CamelContextLifecycle.scala index 2285534fc5..275d52be1c 100644 --- a/akka-camel/src/main/scala/CamelContextLifecycle.scala +++ b/akka-camel/src/main/scala/CamelContextLifecycle.scala @@ -107,7 +107,7 @@ trait CamelContextLifecycle extends Logging { /** * 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 { override def context: CamelContext = super.context diff --git a/akka-camel/src/main/scala/service/CamelService.scala b/akka-camel/src/main/scala/CamelService.scala similarity index 96% rename from akka-camel/src/main/scala/service/CamelService.scala rename to akka-camel/src/main/scala/CamelService.scala index 6cf3a607cc..fdc6741d2b 100644 --- a/akka-camel/src/main/scala/service/CamelService.scala +++ b/akka-camel/src/main/scala/CamelService.scala @@ -2,11 +2,10 @@ * Copyright (C) 2009-2010 Scalable Solutions AB */ -package se.scalablesolutions.akka.camel.service +package se.scalablesolutions.akka.camel import se.scalablesolutions.akka.actor.Actor._ import se.scalablesolutions.akka.actor.{AspectInitRegistry, ActorRegistry} -import se.scalablesolutions.akka.camel.CamelContextManager import se.scalablesolutions.akka.util.{Bootable, Logging} /** diff --git a/akka-camel/src/main/scala/service/ConsumerPublisher.scala b/akka-camel/src/main/scala/ConsumerPublisher.scala similarity index 97% rename from akka-camel/src/main/scala/service/ConsumerPublisher.scala rename to akka-camel/src/main/scala/ConsumerPublisher.scala index 5d2840bf30..35bf6def1d 100644 --- a/akka-camel/src/main/scala/service/ConsumerPublisher.scala +++ b/akka-camel/src/main/scala/ConsumerPublisher.scala @@ -1,7 +1,7 @@ /** * Copyright (C) 2009-2010 Scalable Solutions AB */ -package se.scalablesolutions.akka.camel.service +package se.scalablesolutions.akka.camel import collection.mutable.ListBuffer @@ -13,7 +13,6 @@ import org.apache.camel.builder.RouteBuilder import se.scalablesolutions.akka.actor._ 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.util.Logging @@ -42,7 +41,7 @@ class ConsumerPublisher extends Actor with Logging { latch.countDown // needed for testing only. } case d: ConsumerMethodRegistered => { - handleConsumerMethodDetected(d) + handleConsumerMethodRegistered(d) latch.countDown // needed for testing only. } 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)) } - private def handleConsumerMethodDetected(event: ConsumerMethodRegistered) { + private def handleConsumerMethodRegistered(event: ConsumerMethodRegistered) { // using the actor uuid is highly experimental - val objectId = event.init.actorRef.uuid val targetClass = event.init.target.getName val targetMethod = event.method.getName + val objectId = "%s_%s" format (event.init.actorRef.uuid, targetMethod) CamelContextManager.activeObjectRegistry.put(objectId, event.activeObject) CamelContextManager.context.addRoutes(new ConsumerMethodRoute(event.uri, objectId, targetMethod)) diff --git a/akka-camel/src/test/scala/service/CamelServiceFeatureTest.scala b/akka-camel/src/test/scala/CamelServiceFeatureTest.scala similarity index 97% rename from akka-camel/src/test/scala/service/CamelServiceFeatureTest.scala rename to akka-camel/src/test/scala/CamelServiceFeatureTest.scala index 6441488470..6abaf007eb 100644 --- a/akka-camel/src/test/scala/service/CamelServiceFeatureTest.scala +++ b/akka-camel/src/test/scala/CamelServiceFeatureTest.scala @@ -1,4 +1,4 @@ -package se.scalablesolutions.akka.camel.service +package se.scalablesolutions.akka.camel 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, ActorRegistry} -import se.scalablesolutions.akka.camel.{CamelContextManager, Message, Consumer} class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with GivenWhenThen { import CamelServiceFeatureTest._ diff --git a/akka-camel/src/test/scala/service/ConsumerRegisteredTest.scala b/akka-camel/src/test/scala/ConsumerRegisteredTest.scala similarity index 94% rename from akka-camel/src/test/scala/service/ConsumerRegisteredTest.scala rename to akka-camel/src/test/scala/ConsumerRegisteredTest.scala index e69dd69339..bf6073bbcd 100644 --- a/akka-camel/src/test/scala/service/ConsumerRegisteredTest.scala +++ b/akka-camel/src/test/scala/ConsumerRegisteredTest.scala @@ -1,4 +1,4 @@ -package se.scalablesolutions.akka.camel.service +package se.scalablesolutions.akka.camel import org.junit.Test 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.annotation.consume -import se.scalablesolutions.akka.camel.Consumer object ConsumerRegisteredTest { @consume("mock:test1") diff --git a/akka-camel/src/test/scala/service/PublishRequestorTest.scala b/akka-camel/src/test/scala/PublishRequestorTest.scala similarity index 95% rename from akka-camel/src/test/scala/service/PublishRequestorTest.scala rename to akka-camel/src/test/scala/PublishRequestorTest.scala index d076f98d1f..bdb11c2792 100644 --- a/akka-camel/src/test/scala/service/PublishRequestorTest.scala +++ b/akka-camel/src/test/scala/PublishRequestorTest.scala @@ -1,14 +1,12 @@ -package se.scalablesolutions.akka.camel.service +package se.scalablesolutions.akka.camel import java.util.concurrent.{CountDownLatch, TimeUnit} import org.junit.{Before, After, Test} 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.camel.Consumer +import se.scalablesolutions.akka.actor.{Actor, ActorRef, ActorRegistry, ActorRegistered, ActorUnregistered} import se.scalablesolutions.akka.camel.support.{SetExpectedMessageCount => SetExpectedTestMessageCount, _} class PublishRequestorTest extends JUnitSuite { diff --git a/akka-http/src/main/scala/Initializer.scala b/akka-http/src/main/scala/Initializer.scala index d47357c710..da95a39b77 100644 --- a/akka-http/src/main/scala/Initializer.scala +++ b/akka-http/src/main/scala/Initializer.scala @@ -6,7 +6,7 @@ package se.scalablesolutions.akka.servlet import se.scalablesolutions.akka.remote.BootableRemoteActorService 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.util.{Logging, Bootable} diff --git a/akka-kernel/src/main/scala/Kernel.scala b/akka-kernel/src/main/scala/Kernel.scala index db460062c8..4b5fa83574 100644 --- a/akka-kernel/src/main/scala/Kernel.scala +++ b/akka-kernel/src/main/scala/Kernel.scala @@ -7,7 +7,7 @@ package se.scalablesolutions.akka.kernel import se.scalablesolutions.akka.servlet.AkkaLoader import se.scalablesolutions.akka.remote.BootableRemoteActorService 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 object Main { diff --git a/akka-samples/akka-sample-camel/src/main/scala/Application2.scala b/akka-samples/akka-sample-camel/src/main/scala/Application2.scala index 8a789d13bf..411f7b96b4 100644 --- a/akka-samples/akka-sample-camel/src/main/scala/Application2.scala +++ b/akka-samples/akka-sample-camel/src/main/scala/Application2.scala @@ -1,6 +1,6 @@ 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.actor.Actor._ diff --git a/akka-samples/akka-sample-camel/src/main/scala/Boot.scala b/akka-samples/akka-sample-camel/src/main/scala/Boot.scala index 138e4c364d..24e0a41605 100644 --- a/akka-samples/akka-sample-camel/src/main/scala/Boot.scala +++ b/akka-samples/akka-sample-camel/src/main/scala/Boot.scala @@ -7,9 +7,9 @@ import org.apache.camel.spring.spi.ApplicationContextRegistry import org.springframework.context.support.ClassPathXmlApplicationContext import se.scalablesolutions.akka.actor.Actor._ +import se.scalablesolutions.akka.actor.{ActiveObject, SupervisorFactory} import se.scalablesolutions.akka.camel.CamelContextManager import se.scalablesolutions.akka.config.ScalaConfig._ -import se.scalablesolutions.akka.actor.{ActiveObject, SupervisorFactory} /** * @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[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]) }