Code Monkey home page Code Monkey logo

publisher's Introduction

Scalable message publisher

To start the service:

sudo docker run --name redis -p 6379:6379 -d redis

sbt receiver/run

sbt sender/run

Overview

Schema

This is demo of horizontally scalable message delivery/publishing system.

Every receiver exposes graphql api:

type Mutation {
    publish(msg: String!): Boolean!
    subscribe(addr: String!): Boolean!
    unsubscribe(addr: String!): Boolean!
}

type Queries {
    history(from: Int!, to: Int!): [String!]!
}

Receivers save messages to queue (based on redis list, but could be ant other event queue) senders read data from the queue and delivers it to the client.

This is not production ready for sure, there are some obvious improvements to be made:

  • Use proper types for users, messages, urls etc.
  • Do not pull subscribers every time new message has arrived, each sender service should pull active subscribers ones and after that receiver services should send subscribe/unsubscribe events in fan-out way to senders.
  • Using different effects for resources acquiring and processing.
  • Better error handling.
  • Proper integration testing(probably with test containers to start clients as well).
  • Send health checks to clients.

publisher's People

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.