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 sqsClient;
 | 
			
		||||
let requestQueueURL;
 | 
			
		||||
let queueUrls = new Map();
 | 
			
		||||
const queueUrls = new Map();
 | 
			
		||||
let stopped = false;
 | 
			
		||||
 | 
			
		||||
function AwsSqsProducer() {
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ let pubSubClient;
 | 
			
		||||
 | 
			
		||||
const topics = [];
 | 
			
		||||
const subscriptions = [];
 | 
			
		||||
let queueProps = [];
 | 
			
		||||
const queueProps = [];
 | 
			
		||||
 | 
			
		||||
function PubSubProducer() {
 | 
			
		||||
    this.send = async (responseTopic, scriptId, rawResponse, headers) => {
 | 
			
		||||
@ -107,7 +107,12 @@ async function createTopic(topic) {
 | 
			
		||||
 | 
			
		||||
async function createSubscription(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);
 | 
			
		||||
        logger.info('Created new Pub/Sub subscription: %s', topic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user