/* * Copyright 2022 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ export declare interface Message { MessageBody: string; MessageAttributes: object; MessageGroupId: string; MessageDeduplicationId: string; } export declare interface BatchedQueueClientOptions { log:Console; maxSqsPollTime: number; s3ClientOpts: object; sqsClientOpts: object; swapBucket: string; swapPrefix: string; inQueue:string; outQueue:string; } export declare class BatchedQueueClient { /** * Creates a message specific to the pump queue * @param {string} owner * @param {string} repo * @param {object} record */ static createMessage(owner, repo, record): Message; /** * Creates a new client * @param {BatchedQueueClientOptions} opts */ constructor(opts:BatchedQueueClientOptions); /** * Extended version of the SQS ReceiveMessageCommand, that supports long polling for wait times * over 20s and max messages for over 10. It will continue at least `minTime` seconds to poll * until `maxMessages` are received. It will continue polling if at least 1 message was * received until the `maxTime` is reached. * * @param {number} [minTime = 10] Minimum poll time in seconds. * @param {number} [maxTime = 30] Maximum poll time in seconds. * @param {number} [maxMessages = 1000] Maximum poll messages * @returns {Promise} */ receive(minTime:number, maxTime:number, maxMessages:number): Promise; /** * Delete messages from the inQueue * @param {Message[]} messages * @returns {Promise} */ delete(messages: Message[]): Promise; /** * Serializes a message to the swap storage. * @param {Message} message * @returns {Promise} a new message containing the information about the swap location. */ serialize(message: Message): Promise; /** * Sends a batch of messages to the `outQueue`. * @param {Message[]} messages * @returns {Promise} Message IDs of messages sent successfully */ send(messages:Message[]): Promise; /** * Closes this client and destroys the underlying datastructures */ close(): void; }