added queue params to pubsub js-executor
This commit is contained in:
parent
cce6a44adc
commit
8c413f8b9c
@ -32,7 +32,7 @@ const poolInterval = config.get('js.response_poll_interval');
|
|||||||
let queueAttributes = {FifoQueue: 'true', ContentBasedDeduplication: 'true'};
|
let queueAttributes = {FifoQueue: 'true', ContentBasedDeduplication: 'true'};
|
||||||
let sqsClient;
|
let sqsClient;
|
||||||
let requestQueueURL;
|
let requestQueueURL;
|
||||||
let queueUrls = new Map();
|
const queueUrls = new Map();
|
||||||
let stopped = false;
|
let stopped = false;
|
||||||
|
|
||||||
function AwsSqsProducer() {
|
function AwsSqsProducer() {
|
||||||
|
|||||||
@ -30,7 +30,7 @@ let pubSubClient;
|
|||||||
|
|
||||||
const topics = [];
|
const topics = [];
|
||||||
const subscriptions = [];
|
const subscriptions = [];
|
||||||
let queueProps = [];
|
const queueProps = [];
|
||||||
|
|
||||||
function PubSubProducer() {
|
function PubSubProducer() {
|
||||||
this.send = async (responseTopic, scriptId, rawResponse, headers) => {
|
this.send = async (responseTopic, scriptId, rawResponse, headers) => {
|
||||||
@ -107,7 +107,12 @@ async function createTopic(topic) {
|
|||||||
|
|
||||||
async function createSubscription(topic) {
|
async function createSubscription(topic) {
|
||||||
if (!subscriptions.includes(topic)) {
|
if (!subscriptions.includes(topic)) {
|
||||||
await pubSubClient.topic(topic).createSubscription(topic);
|
await pubSubClient.createSubscription(topic, topic, {
|
||||||
|
topic: topic,
|
||||||
|
subscription: topic,
|
||||||
|
ackDeadlineSeconds: queueProps['ackDeadlineInSec'],
|
||||||
|
messageRetentionDuration: {seconds: queueProps['messageRetentionInSec']}
|
||||||
|
});
|
||||||
subscriptions.push(topic);
|
subscriptions.push(topic);
|
||||||
logger.info('Created new Pub/Sub subscription: %s', topic);
|
logger.info('Created new Pub/Sub subscription: %s', topic);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user