From c94dc5972e875d8d22f85c5ad0b236e6aa0e680d Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Wed, 21 Apr 2021 19:51:59 +0300 Subject: [PATCH] remote js-executor: parameter added TB_KAFKA_ACKS="1" --- msa/js-executor/api/jsInvokeMessageProcessor.js | 2 +- msa/js-executor/config/custom-environment-variables.yml | 1 + msa/js-executor/queue/kafkaTemplate.js | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/msa/js-executor/api/jsInvokeMessageProcessor.js b/msa/js-executor/api/jsInvokeMessageProcessor.js index a3acdc42da..2964291a30 100644 --- a/msa/js-executor/api/jsInvokeMessageProcessor.js +++ b/msa/js-executor/api/jsInvokeMessageProcessor.js @@ -88,7 +88,7 @@ JsInvokeMessageProcessor.prototype.onJsInvokeMessage = function(message) { logger.error(err.stack); } } - logger.warn('[%s] SLOW PROCESSING [%s]ms, functionName [%s], request: ', requestId, tTook, functionName); + logger.warn('[%s] SLOW PROCESSING [%s]ms, functionName [%s]', requestId, tTook, functionName); if (slowQueryLogBody) { logger.info('Slow request body: %s', JSON.stringify(request, null, 4)) } diff --git a/msa/js-executor/config/custom-environment-variables.yml b/msa/js-executor/config/custom-environment-variables.yml index 0076095422..e1a45e74d8 100644 --- a/msa/js-executor/config/custom-environment-variables.yml +++ b/msa/js-executor/config/custom-environment-variables.yml @@ -25,6 +25,7 @@ kafka: # Kafka Bootstrap Servers servers: "TB_KAFKA_SERVERS" replication_factor: "TB_QUEUE_KAFKA_REPLICATION_FACTOR" + acks: "TB_KAFKA_ACKS" # -1 = all; 0 = no acknowledgments; 1 = only waits for the leader to acknowledge topic_properties: "TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES" use_confluent_cloud: "TB_QUEUE_KAFKA_USE_CONFLUENT_CLOUD" client_id: "KAFKA_CLIENT_ID" #inject pod name to easy identify the client using /opt/kafka/bin/kafka-consumer-groups.sh diff --git a/msa/js-executor/queue/kafkaTemplate.js b/msa/js-executor/queue/kafkaTemplate.js index ae1e6ae3ca..ad87c1efa4 100644 --- a/msa/js-executor/queue/kafkaTemplate.js +++ b/msa/js-executor/queue/kafkaTemplate.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -const {logLevel, Kafka} = require('kafkajs'); +const {logLevel, Kafka, CompressionTypes} = require('kafkajs'); const config = require('config'), JsInvokeMessageProcessor = require('../api/jsInvokeMessageProcessor'), @@ -22,6 +22,7 @@ const config = require('config'), const replicationFactor = config.get('kafka.replication_factor'); const topicProperties = config.get('kafka.topic_properties'); const kafkaClientId = config.get('kafka.client_id'); +const acks = config.get('kafka.acks'); let kafkaClient; let kafkaAdmin; @@ -35,6 +36,7 @@ function KafkaProducer() { return producer.send( { topic: responseTopic, + acks: acks, messages: [ { key: scriptId,