@@ -12,13 +12,12 @@ import spray.json._
1212
1313import scala .concurrent .Future
1414
15- class KindBasedLoadBalancer (config : WhiskConfig ,
16- feedFactory : FeedFactory ,
17- controllerInstance : ControllerInstanceId ,
18- implicit val messagingProvider : MessagingProvider = SpiLoader .get[MessagingProvider ])(
15+ class MuxBalancer (config : WhiskConfig ,
16+ feedFactory : FeedFactory ,
17+ controllerInstance : ControllerInstanceId ,
18+ implicit val messagingProvider : MessagingProvider = SpiLoader .get[MessagingProvider ])(
1919 implicit actorSystem : ActorSystem ,
20- logging : Logging ,
21- materializer : ActorMaterializer )
20+ logging : Logging )
2221 extends CommonLoadBalancer (config, feedFactory, controllerInstance) {
2322
2423 private val balancers = lbConfig.strategy.foldLeft(Map .empty[String , LoadBalancer ]) {
@@ -37,10 +36,13 @@ class KindBasedLoadBalancer(config: WhiskConfig,
3736 }
3837 override protected val invokerPool : ActorRef = actorSystem.actorOf(Props .empty)
3938
40- /** 1. Publish a message to the loadbalancer */
39+ /**
40+ * Publish a message to the loadbalancer
41+ *
42+ * Select the LoadBalancer based on the annotation, if available, otherwise use the default one
43+ **/
4144 override def publish (action : ExecutableWhiskActionMetaData , msg : ActivationMessage )(
4245 implicit transid : TransactionId ): Future [Future [Either [ActivationId , WhiskActivation ]]] = {
43- logging.info(this , " We are here" )
4446 action.annotations.get(" activationStrategy" ) match {
4547 case None =>
4648 balancers(" default" ).publish(action, msg)
@@ -51,26 +53,18 @@ class KindBasedLoadBalancer(config: WhiskConfig,
5153 balancers(" default" ).publish(action, msg)
5254 }
5355 }
54- case ( Some (_) ) => balancers(" default" ).publish(action, msg)
56+ case Some (_) => balancers(" default" ).publish(action, msg)
5557 }
56-
57- // if (action.annotations.get("activationStrategy").isDefined && balancers.contains(action.annotations.get("activationStrategy").get.toString.)
58- // {
59- // balancers().publish(action, msg)
60- // } else {
61- // balancers("default").publish(action, msg)
62- // }
6358 }
6459}
6560
66- object KindBasedLoadBalancer extends LoadBalancerProvider {
61+ object MuxBalancer extends LoadBalancerProvider {
6762
6863 override def instance (whiskConfig : WhiskConfig , instance : ControllerInstanceId )(
6964 implicit actorSystem : ActorSystem ,
70- logging : Logging ,
71- materializer : ActorMaterializer ): LoadBalancer = {
65+ logging : Logging ): LoadBalancer = {
7266
73- new KindBasedLoadBalancer (whiskConfig, createFeedFactory(whiskConfig, instance), instance)
67+ new MuxBalancer (whiskConfig, createFeedFactory(whiskConfig, instance), instance)
7468 }
7569
7670 def requiredProperties =
0 commit comments