@@ -17,12 +17,14 @@ class MuxBalancer(config: WhiskConfig,
1717 controllerInstance : ControllerInstanceId ,
1818 implicit val messagingProvider : MessagingProvider = SpiLoader .get[MessagingProvider ])(
1919 implicit actorSystem : ActorSystem ,
20- logging : Logging )
20+ logging : Logging ,
21+ materializer : ActorMaterializer )
2122 extends CommonLoadBalancer (config, feedFactory, controllerInstance) {
2223
23- private val balancers = lbConfig.strategy.foldLeft(Map .empty[String , LoadBalancer ]) {
24- case (result, (name, lbClass)) => result + (name -> getClass(lbClass))
25- }
24+ private val balancers : Map [String , LoadBalancer ] =
25+ lbConfig.strategy.custom.foldLeft(Map (" default" -> getClass(lbConfig.strategy.default))) {
26+ case (result, (name, strategyConfig)) => result + (name -> getClass[LoadBalancer ](strategyConfig.className))
27+ }
2628
2729 def getClass [A ](name : String ): A = {
2830 logging.info(this , " '" + name + " '$" )
@@ -37,9 +39,9 @@ class MuxBalancer(config: WhiskConfig,
3739 override protected val invokerPool : ActorRef = actorSystem.actorOf(Props .empty)
3840
3941 /**
40- * Publish a message to the loadbalancer
41- *
42- * Select the LoadBalancer based on the annotation, if available, otherwise use the default one
42+ * Publish a message to the loadbalancer
43+ *
44+ * Select the LoadBalancer based on the annotation, if available, otherwise use the default one
4345 **/
4446 override def publish (action : ExecutableWhiskActionMetaData , msg : ActivationMessage )(
4547 implicit transid : TransactionId ): Future [Future [Either [ActivationId , WhiskActivation ]]] = {
@@ -53,7 +55,7 @@ class MuxBalancer(config: WhiskConfig,
5355 balancers(" default" ).publish(action, msg)
5456 }
5557 }
56- case Some (_) => balancers(" default" ).publish(action, msg)
58+ case Some (_) => balancers(" default" ).publish(action, msg)
5759 }
5860 }
5961}
@@ -62,7 +64,8 @@ object MuxBalancer extends LoadBalancerProvider {
6264
6365 override def instance (whiskConfig : WhiskConfig , instance : ControllerInstanceId )(
6466 implicit actorSystem : ActorSystem ,
65- logging : Logging ): LoadBalancer = {
67+ logging : Logging ,
68+ materializer : ActorMaterializer ): LoadBalancer = {
6669
6770 new MuxBalancer (whiskConfig, createFeedFactory(whiskConfig, instance), instance)
6871 }
0 commit comments