Backend/Microservices/PaymentService/server/src/Helpers/sqsHelper.js
/**
    * Method to receive Message from a queue.
    * @param maxNumberOfMessage: The Max number of message you want to receive.
    * @returns {Promise<Boolean|Array>}: if Error false, else the array of messages.
    */
Method to receive Message from a queue.
@param maxNumberOfMessage: The Max number of message you want to receive.
@returns {Promise}: if Error false, else the array of messages.
Method to receive Message from a queue . @param maxNumberOfMessage : The Max number of message you want to receive . @returns { Promise } : if Error false else the array of messages .
receiveMessages(maxNumberOfMessage) {
      return new Promise((resolve, reject) => {
         const receiveParams = {};
         receiveParams[constants.SQS_QUEUE_URL] = this._queueUrl;
         receiveParams[constants.SQS_MAX_NUMBER_OF_MESSAGE] = maxNumberOfMessage;
         awsHelper.sqs.receiveMessage(receiveParams, (err, data) => {
            if (err) {
               printer.printError(err);
               reject(false);
            } else {
               resolve(data.Messages);
            }
         });
      });
   }
receiveMessages ( maxNumberOfMessage ) { return new Promise ( ( resolve , reject ) => { const receiveParams = { } ; receiveParams [ constants . SQS_QUEUE_URL ] = this . _queueUrl ; receiveParams [ constants . SQS_MAX_NUMBER_OF_MESSAGE ] = maxNumberOfMessage ; awsHelper . sqs . receiveMessage ( receiveParams , ( err , data ) => { if ( err ) { printer . printError ( err ) ; reject ( false ) ; } else { resolve ( data . Messages ) ; } } ) ; } ) ; }
Method to receive Message from a queue.
Method to receive Message from a queue .