Giter Site home page Giter Site logo

sns's Introduction

Build Status codecov Docker Pulls

Fake SNS

Fake Amazon Simple Notification Service (SNS) for testing. Supports:

  • Create/List/Delete topics
  • Subscribe endpoint
  • Publish message
  • Subscription persistence
  • Integrations with (Fake-)SQS, File, HTTP, RabbitMQ, Slack

Usage

Docker

Based on the official java:8-jre-alpine image. Run it with the command:

docker run -d -p 9911:9911 s12v/sns

If you would like to keep the topic/subscription database in the current host folder:

docker run -d -p 9911:9911 -v "$PWD":/etc/sns s12v/sns

Using aws-cli

The image has aws-cli preinstalled. For example, create a topic:

docker exec <CONTAINER_ID> 'aws sns --endpoint-url http://localhost:9911 create-topic --name test1'

Jar

Download the latest release from https://github.com/s12v/sns/releases and run:

DB_PATH=/tmp/db.json java -jar sns-0.1.0.jar

Requires Java8.

Configuration

Configuration can be set via environment variables:

  • DB_PATH - path to subscription database file, default: db.json
  • HTTP_INTERFACE - interface to bind to, default: 0.0.0.0
  • HTTP_PORT - tcp port, default: 9911

Supported integrations

  • Amazon SQS: aws-sqs://queueName?amazonSQSEndpoint=...&accessKey=&secretKey=
  • RabbitMQ: rabbitmq://hostname[:port]/exchangeName[?options]
  • HTTP: http:hostName[:port][/resourceUri][?options]
  • File: file://tmp?fileName=sns1.txt
  • Slack: slack:@username?webhookUrl=https://hooks.slack.com/services/aaa/bbb/ccc

See camel documentation for more details

Example fake SQS integration:

Tested with elasticmq. See example/docker-compose.yml and example/config/db.json

docker run -d -p 9911:9911 -v "$PWD/example/config":/etc/sns s12v/sns

Development

Unit tests

sbt test

Integration tests

It's tested with AWS Ruby and PHP SDKs. Start elasticmq for SQS integration tests with

docker run -d -p 9324:9324 s12v/elasticmq

Ruby SDK tests:

bundle install
ENDPOINT=http://localhost:9911 bundle exec cucumber

PHP SDK tests:

composer install
./bin/behat

sns's People

Contributors

agnaldo4j avatar ankon avatar s12v avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.