Nondeterministic Polynomial Munchies

    sqs-huge-message

    0.2.1 • Public • Published

    sqs-huge-message

    A service to send and receive huge (and not huge) payload to SQS with Lambda.

    Node.js CI NPM version

    How it works

    "A picture is worth a thousand words", said a painter, then check this out this nice and emoji flow picture below.

    send message

    receive message

    Nice, isn't, but we have a explanation in words too: AWS Node SDK has a little anoing particularity about size of messages, sometimes we need send a huge message payload to SQS, but the AWS SQS has a limit of 256kb (😢). One way to tackle this particularity is send a huge message payload to S3 Bucket and a meta-data, with info about file on Bucket, to SQS. For receive messages the process should work as the same way, and after receivement the message will be deleted from SQS.

    Instalation

    npm install sqs-huge-message
    

    Usage

    Initialize
    import { SqsService } from './sqs-huge-msg';
    
    const sqsOptions = {
        endpoint: ENDPOINT_SQS,
        region: REGION,
        queueName: QUEUE_NAME,
        s3EndpointUrl: ENDPOINT_S3,
        s3Bucket: BUCKET_NAME,
    }
    
    const sqsService = new SqsService(sqsOptions);
    Send Message
    import { SqsService } from './sqs-huge-msg';
    
    const payload = await sqsService.sendMessage(sqsOptions.queueName, message);
    Receive Message
    import { SqsService } from './sqs-huge-msg';
    
    const message = await sqsService.getMessage(sqsOptions.queueName);

    More info

    I based my project on this awesome project: https://github.com/aspecto-io/sns-sqs-big-payload This project works very well, but doesn't work with AWS Lambda.

    Keywords

    Install

    npm i sqs-huge-message

    DownloadsWeekly Downloads

    2

    Version

    0.2.1

    License

    Apache-2.0

    Unpacked Size

    82.2 kB

    Total Files

    13

    Last publish

    Collaborators

    • lesimoes