Giter Site home page Giter Site logo

mqbridge's Introduction

mqbridge

Translate messages from one message queue system to another one

GoCard FOSSA Status GitHub Release GitHub code size in bytes GitHub license

Data flow

FOSSA Status

Message queue systems supported

type producer consumer
file tail(in_channel) println out_channel, data
pg listen in_channel select out_channel(data)
nats Subscribe(in_channel) Publish(out_channel, data)

Installation

Config

      --in=        Producer connect string
      --out=       Consumer connect string
      --bridge=    Bridge(s) in form 'in_channel[,out_channel]'

Connect strings

  • file - file://
  • pg - postgres://user:pass@host:port/db?sslmode=disable
  • nats - nats://user:pass@host:port

Usage

Producers

See also: Examples directory

mqbridge uses the following as data source:

  • file - tail files named as in_channel
  • pg - listen in_channel
  • nats - subscribe to in_channel

Consumers

mqbridge sends received messages as

  • file - add lines to files named as out_channel
  • pg - calls sql select out_channel(data)
  • nats - publish message to out_channel

pg usage sample

This sample shows how to setup pg -> pg bridge.

  1. Setup pg consumer (db1) for out_channel = bridge (see function name)
create table mqbridge_data (line jsonb);

create or replace function bridge(a jsonb) returns void language plpgsql as 
$_$ 
  begin insert into mqbridge_data (line) values(a); end 
$_$;
  1. Run mqbridge
./mqbridge --bridge event,bridge \
  --in postgres://op:op@localhost:5432/db0?sslmode=disable \
 --out postgres://op:op@localhost:5432/db1?sslmode=disable
  1. Run at pg producer (db0) SQL
notify event, '{"test": 1972}';
  1. See results in db1
select * from mqbridge_data ;
      line     
----------------
 {"test": 1972}

TODO

  • centrifugo support
  • add channel buffer length in bridge config args (--buffer []int)
  • (may be) postgresql: reuse connect if in=out
  • (may be) use github.com/jaehue/anyq for mq bridge

License

The MIT License (MIT), see LICENSE.

Copyright (c) 2017 Alexey Kovrizhkin [email protected]

mqbridge's People

Contributors

fossabot avatar lekovr 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.