Commit c94dc5972e875d8d22f85c5ad0b236e6aa0e680d

Authored by Sergey Matvienko
Committed by Andrew Shvayka
1 parent a569058c

remote js-executor: parameter added TB_KAFKA_ACKS="1"

@@ -88,7 +88,7 @@ JsInvokeMessageProcessor.prototype.onJsInvokeMessage = function(message) { @@ -88,7 +88,7 @@ JsInvokeMessageProcessor.prototype.onJsInvokeMessage = function(message) {
88 logger.error(err.stack); 88 logger.error(err.stack);
89 } 89 }
90 } 90 }
91 - logger.warn('[%s] SLOW PROCESSING [%s]ms, functionName [%s], request: ', requestId, tTook, functionName); 91 + logger.warn('[%s] SLOW PROCESSING [%s]ms, functionName [%s]', requestId, tTook, functionName);
92 if (slowQueryLogBody) { 92 if (slowQueryLogBody) {
93 logger.info('Slow request body: %s', JSON.stringify(request, null, 4)) 93 logger.info('Slow request body: %s', JSON.stringify(request, null, 4))
94 } 94 }
@@ -25,6 +25,7 @@ kafka: @@ -25,6 +25,7 @@ kafka:
25 # Kafka Bootstrap Servers 25 # Kafka Bootstrap Servers
26 servers: "TB_KAFKA_SERVERS" 26 servers: "TB_KAFKA_SERVERS"
27 replication_factor: "TB_QUEUE_KAFKA_REPLICATION_FACTOR" 27 replication_factor: "TB_QUEUE_KAFKA_REPLICATION_FACTOR"
  28 + acks: "TB_KAFKA_ACKS" # -1 = all; 0 = no acknowledgments; 1 = only waits for the leader to acknowledge
28 topic_properties: "TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES" 29 topic_properties: "TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES"
29 use_confluent_cloud: "TB_QUEUE_KAFKA_USE_CONFLUENT_CLOUD" 30 use_confluent_cloud: "TB_QUEUE_KAFKA_USE_CONFLUENT_CLOUD"
30 client_id: "KAFKA_CLIENT_ID" #inject pod name to easy identify the client using /opt/kafka/bin/kafka-consumer-groups.sh 31 client_id: "KAFKA_CLIENT_ID" #inject pod name to easy identify the client using /opt/kafka/bin/kafka-consumer-groups.sh
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -const {logLevel, Kafka} = require('kafkajs'); 16 +const {logLevel, Kafka, CompressionTypes} = require('kafkajs');
17 17
18 const config = require('config'), 18 const config = require('config'),
19 JsInvokeMessageProcessor = require('../api/jsInvokeMessageProcessor'), 19 JsInvokeMessageProcessor = require('../api/jsInvokeMessageProcessor'),
@@ -22,6 +22,7 @@ const config = require('config'), @@ -22,6 +22,7 @@ const config = require('config'),
22 const replicationFactor = config.get('kafka.replication_factor'); 22 const replicationFactor = config.get('kafka.replication_factor');
23 const topicProperties = config.get('kafka.topic_properties'); 23 const topicProperties = config.get('kafka.topic_properties');
24 const kafkaClientId = config.get('kafka.client_id'); 24 const kafkaClientId = config.get('kafka.client_id');
  25 +const acks = config.get('kafka.acks');
25 26
26 let kafkaClient; 27 let kafkaClient;
27 let kafkaAdmin; 28 let kafkaAdmin;
@@ -35,6 +36,7 @@ function KafkaProducer() { @@ -35,6 +36,7 @@ function KafkaProducer() {
35 return producer.send( 36 return producer.send(
36 { 37 {
37 topic: responseTopic, 38 topic: responseTopic,
  39 + acks: acks,
38 messages: [ 40 messages: [
39 { 41 {
40 key: scriptId, 42 key: scriptId,