markusthoemmes commented on a change in pull request #2425: Throttle message
bus consumption.
URL:
https://github.com/apache/incubator-openwhisk/pull/2425#discussion_r124457949
##########
File path:
core/controller/src/main/scala/whisk/core/loadBalancer/LoadBalancerService.scala
##########
@@ -234,22 +244,33 @@ class LoadBalancerService(config: WhiskConfig, instance:
InstanceId, entityStore
}, (m, i) => sendActivationToInvoker(messageProducer, m, i),
pingConsumer))
}
- /** Subscribes to active acks (completion messages from the invokers). */
- private val activeAckConsumer = new
KafkaConsumerConnector(config.kafkaHost, "completions",
s"completed${instance.toInt}")
+ /**
+ * Subscribes to active acks (completion messages from the invokers), and
+ * registers a handler for received active acks from invokers.
+ */
+ val maxActiveAcksPerPoll = 128
+ val activeAckPollDuration = 1.second
- /** Registers a handler for received active acks from invokers. */
- activeAckConsumer.onMessage((topic, _, _, bytes) => {
+ private val activeAckConsumer = new
KafkaConsumerConnector(config.kafkaHost, "completions",
s"completed${instance.toInt}", maxPeek = maxActiveAcksPerPoll)
+ val activationFeed = actorSystem.actorOf(Props {
+ new MessageFeed("activeack", logging, activeAckConsumer,
maxActiveAcksPerPoll, activeAckPollDuration, processActiveAck)
+ })
+
+ def processActiveAck(bytes: Array[Byte]): Future[Unit] = Future {
val raw = new String(bytes, StandardCharsets.UTF_8)
CompletionMessage.parse(raw) match {
case Success(m: CompletionMessage) =>
processCompletion(m.response, m.transid, false)
// treat left as success (as it is the result a the message
exceeding the bus limit)
val isSuccess = m.response.fold(l => true, r =>
!r.response.isWhiskError)
+ activationFeed ! MessageFeed.Processed
Review comment:
Send this message after the match to avoid duplication?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services