iota-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonyfaust...@apache.org
Subject [1/4] incubator-iota git commit: Display Routees on activeactors endpoint
Date Fri, 08 Jul 2016 01:06:38 GMT
Repository: incubator-iota
Updated Branches:
  refs/heads/master 40f6adb25 -> c381fc428


Display Routees on activeactors endpoint

- Using GetRoutees message
- Using Routee.toString to get the path (might exist a better way)


Project: http://git-wip-us.apache.org/repos/asf/incubator-iota/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-iota/commit/1fb9c1cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-iota/tree/1fb9c1cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-iota/diff/1fb9c1cf

Branch: refs/heads/master
Commit: 1fb9c1cf83e706558adb66bc8b925538eeb9d5ef
Parents: df74281
Author: Barbara Gomes <barbaramaltagomes@gmail.com>
Authored: Thu Jul 7 17:23:51 2016 -0700
Committer: Barbara Gomes <barbaramaltagomes@gmail.com>
Committed: Thu Jul 7 17:23:51 2016 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/iota/fey/Ensemble.scala     |  4 +++-
 fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala |  3 +++
 .../main/scala/org/apache/iota/fey/FeyGenericActor.scala  |  5 +++++
 .../scala/org/apache/iota/fey/IdentifyFeyActors.scala     | 10 ++++++++++
 .../main/scala/org/apache/iota/fey/Orchestration.scala    |  3 +++
 5 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/1fb9c1cf/fey-core/src/main/scala/org/apache/iota/fey/Ensemble.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/Ensemble.scala b/fey-core/src/main/scala/org/apache/iota/fey/Ensemble.scala
index 87fbe7f..4e651d4 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/Ensemble.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/Ensemble.scala
@@ -19,7 +19,7 @@ package org.apache.iota.fey
 
 import akka.actor.SupervisorStrategy.Restart
 import akka.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, PoisonPill, Props, Terminated}
-import akka.routing.{DefaultResizer, SmallestMailboxPool}
+import akka.routing.{ActorRefRoutee, DefaultResizer, GetRoutees, SmallestMailboxPool}
 import org.apache.iota.fey.JSON_PATH._
 import play.api.libs.json.JsObject
 
@@ -57,6 +57,8 @@ protected class Ensemble(val orchestrationID: String,
       }
       throw new RestartEnsemble(s"DEAD Performer ${actor.path.name}")
 
+    case GetRoutees => //Discard
+
     case x => log.warning(s"Message $x not treated by Ensemble")
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/1fb9c1cf/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala b/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala
index c01ba3c..fe9149a 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala
@@ -26,6 +26,7 @@ import Utils._
 import akka.actor.SupervisorStrategy._
 import play.api.libs.json._
 import JSON_PATH._
+import akka.routing.GetRoutees
 import org.apache.iota.fey.Orchestration.{CREATE_ENSEMBLES, DELETE_ENSEMBLES, UPDATE_ENSEMBLES}
 import com.eclipsesource.schema._
 
@@ -87,6 +88,8 @@ protected class FeyCore extends Actor with ActorLogging{
           }
       }
 
+    case GetRoutees => //Discard
+
     case x =>
       log.info(s"Received $x")
 

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/1fb9c1cf/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala b/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala
index c2344d8..98d8c7c 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala
@@ -18,6 +18,8 @@
 package org.apache.iota.fey
 
 import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable}
+import akka.routing.GetRoutees
+
 import scala.concurrent.duration._
 import scala.concurrent.ExecutionContext.Implicits.global
 
@@ -64,6 +66,9 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
       }
     // In case
     case EXCEPTION(reason) => throw reason
+
+    case GetRoutees => //Discard
+
     //Not treated messages will be pass over to the receiveComplement
     case x => customReceive(x)
   }

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/1fb9c1cf/fey-core/src/main/scala/org/apache/iota/fey/IdentifyFeyActors.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/IdentifyFeyActors.scala b/fey-core/src/main/scala/org/apache/iota/fey/IdentifyFeyActors.scala
index 1dbb5e6..80387db 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/IdentifyFeyActors.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/IdentifyFeyActors.scala
@@ -18,6 +18,7 @@
 package org.apache.iota.fey
 
 import akka.actor.{Actor, ActorIdentity, ActorLogging, ActorPath, Identify}
+import akka.routing.{GetRoutees, Routees}
 import play.api.libs.json._
 
 import scala.collection.mutable.HashSet
@@ -26,6 +27,8 @@ protected class IdentifyFeyActors extends Actor with ActorLogging {
 
   import IdentifyFeyActors._
 
+  val toStringRouteePrefix = "ActorRefRoutee(Actor["
+
   def receive = {
     case IDENTIFY_TREE(startPath) =>
       log.info("Current Actors in system:")
@@ -36,12 +39,19 @@ protected class IdentifyFeyActors extends Actor with ActorLogging {
 
     case path: ActorPath =>
       context.actorSelection(path / "*") ! Identify(())
+      context.actorSelection(path / "*") ! GetRoutees
 
     case ActorIdentity(_, Some(ref)) =>
       actorsPath.add(ref.path.toString)
       log.info(ref.path.toString)
       self ! ref.path
 
+    case routees:Routees =>
+      routees.routees.foreach(routee => {
+        val pathTmp = routee.toString.replace(toStringRouteePrefix,"")
+        actorsPath.add(pathTmp.substring(0, pathTmp.indexOf("#")))
+      })
+
     case _ =>
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/1fb9c1cf/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala b/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala
index 76a8e9f..15a9cdd 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala
@@ -19,6 +19,7 @@ package org.apache.iota.fey
 
 import akka.actor.SupervisorStrategy.Restart
 import akka.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, PoisonPill, Props, Terminated}
+import akka.routing.GetRoutees
 import org.apache.iota.fey.FeyCore.STOP_EMPTY_ORCHESTRATION
 import play.api.libs.json._
 
@@ -55,6 +56,8 @@ protected class Orchestration(val name: String,
       checkForEnsemblesWaitingTermination(actor.path.name)
       stopIfNoOrchestrationisRunning()
 
+    case GetRoutees => //Discard
+
     case x => log.warning(s"Message $x not treated by Orchestrations")
   }
 


Mime
View raw message