Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@5app/region-sync

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@5app/region-sync

Utilities for syncing data between regions

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

region sync

Known Vulnerabilities CircleCI

Wraps SNS/SQS with some boilerplate logic we use for syncing data between regions:

SNS+SQS:

  1. structure all messages with date, fromRegion and JSON encoded payload.

SQS:

  1. prevents handlers being called if source + dest regions are the same
  2. deletes messages after handler has handled (if successful)
  3. sets up the continuous long poll

SQS usage:

const {createHandler} = require('@5app/region-sync');
const queueUrl = 'http://localhost:4576/000000000000/fooq';
const handler = createHandler({
	backoffSeconds: 4,
	longPollSeconds: 1,
	currentRegion: 'us-east-1',
});

handler.addQueueHandler(queueUrl, async function (msg) {
	// handle it, but if promise rejects, the message wont be removed.
});

SNS usage:

const {createPublisher} = require('@5app/region-sync');
const payload = {foo: 'bar'};
const publisher = createPublisher({
	currentRegion: 'us-east-1',
	snsRegion: 'us-east-1',
});
await publisher.publish(topicArn, payload);

testing

LOGS_LEVEL=info npm test

Keywords

FAQs

Package last updated on 20 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc