Giter Club home page Giter Club logo

simple-pub-sub's Introduction

Requirements

Assumes golang, and redis are installed on the system. If there is a connection available to a redis instance running, then you may skip installing redis.

I ran my application on Ubuntu 18.04 using:

  • go version go1.13.5 linux/amd64
  • Redis server v=4.0.9 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=9435c3c2879311f3

To run

To install redis on Ubuntu, run sudo apt-get install redis-server, and on a Mac, run brew install redis using Homebrew. The default port is :6379 for redis, which is what's in config.json . Running redis-cli will open a connection to the redis instance, and can confirm that you're connecting to the correct port.

Configurations are loaded at runtime for the applications, so any changes to config.json should be done before starting the services.

The next steps are to get a terminal window for each service. From the project's base directory, where the makefiles are located, run:

  • make publisher
  • make sumfinder
  • make meanfinder

My Contributions

I wrote all code under /cmd and the makefile. I was closely following redigo's examples for PubSubConn to establish a publish and subsribe connection to the instance of redis.

Potential Improvements

  • Get docker-compose to build images of publisher and subscribers, as well as get the wiring hooked up between images. The advantage of this approach is that setup and running the application would be a single command, and everyone running the application will have the same environment.
  • Increase test coverage. Most of the code is using other libraries. I did however attempt to use an interface to break up some coupling to be able to stub out methods from the redis library so that I can insert my own tests. Due to time constraints, I have left it untouched in feature/maketestable.
  • Use of dockertest library to get integration testing done on docker images.
  • Adding flag to define the range of numbers generated by the publisher.
  • Adding flag to define which configuration file to use, rather than expecting it to be the first argument after the program name.
  • Define default values in case no configuration file is provided.

simple-pub-sub's People

Contributors

dragonpaulz avatar

Watchers

 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.