Commit 8c413f8b9c0b5ba530e81cf4ddf02995c136fcc8

Authored by YevhenBondarenko
1 parent cce6a44a

added queue params to pubsub js-executor

... ... @@ -32,7 +32,7 @@ const poolInterval = config.get('js.response_poll_interval');
32 32 let queueAttributes = {FifoQueue: 'true', ContentBasedDeduplication: 'true'};
33 33 let sqsClient;
34 34 let requestQueueURL;
35   -let queueUrls = new Map();
  35 +const queueUrls = new Map();
36 36 let stopped = false;
37 37
38 38 function AwsSqsProducer() {
... ...
... ... @@ -30,7 +30,7 @@ let pubSubClient;
30 30
31 31 const topics = [];
32 32 const subscriptions = [];
33   -let queueProps = [];
  33 +const queueProps = [];
34 34
35 35 function PubSubProducer() {
36 36 this.send = async (responseTopic, scriptId, rawResponse, headers) => {
... ... @@ -107,7 +107,12 @@ async function createTopic(topic) {
107 107
108 108 async function createSubscription(topic) {
109 109 if (!subscriptions.includes(topic)) {
110   - await pubSubClient.topic(topic).createSubscription(topic);
  110 + await pubSubClient.createSubscription(topic, topic, {
  111 + topic: topic,
  112 + subscription: topic,
  113 + ackDeadlineSeconds: queueProps['ackDeadlineInSec'],
  114 + messageRetentionDuration: {seconds: queueProps['messageRetentionInSec']}
  115 + });
111 116 subscriptions.push(topic);
112 117 logger.info('Created new Pub/Sub subscription: %s', topic);
113 118 }
... ...