All Projects → febytanzil → gobroker

febytanzil / gobroker

Licence: MIT license
golang wrapper for all (to-be) kinds of message brokers

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to gobroker

Garagemq
AMQP message broker implemented with golang
Stars: ✭ 153 (+920%)
Mutual labels:  queue, amqp, messaging, pubsub
Laravel Queue
Laravel Enqueue message queue extension. Supports AMQP, Amazon SQS, Kafka, Google PubSub, Redis, STOMP, Gearman, Beanstalk and others
Stars: ✭ 155 (+933.33%)
Mutual labels:  queue, amqp, messaging
azure-service-bus-go
Golang library for Azure Service Bus -- https://aka.ms/azsb
Stars: ✭ 67 (+346.67%)
Mutual labels:  queue, amqp, messaging
aop
AMQP on Pulsar protocol handler
Stars: ✭ 93 (+520%)
Mutual labels:  amqp, messaging, pubsub
Nsq
A realtime distributed messaging platform
Stars: ✭ 20,663 (+137653.33%)
Mutual labels:  queue, messaging, nsq
qpid-broker-j
Mirror of Apache Qpid Broker-J
Stars: ✭ 52 (+246.67%)
Mutual labels:  amqp, messaging
qpid-python
Mirror of Apache Qpid Python
Stars: ✭ 15 (+0%)
Mutual labels:  amqp, messaging
qpid-cpp
Mirror of Apache Qpid C++
Stars: ✭ 77 (+413.33%)
Mutual labels:  amqp, messaging
Message Bus
Go simple async message bus
Stars: ✭ 166 (+1006.67%)
Mutual labels:  queue, pubsub
pulsar-flume-ng-sink
An Apache Flume Sink implementation to publish data to Apache pulsar
Stars: ✭ 19 (+26.67%)
Mutual labels:  messaging, pubsub
dispatcher
Dispatcher is an asynchronous task queue/job queue based on distributed message passing.
Stars: ✭ 60 (+300%)
Mutual labels:  queue, amqp
Lightbus
RPC & event framework for Python 3
Stars: ✭ 149 (+893.33%)
Mutual labels:  queue, messaging
Amqp Tools
The amqp tools such as delay strategies and so on.
Stars: ✭ 125 (+733.33%)
Mutual labels:  queue, amqp
Amqp Interop
PHP 7.1+. Promoting the interoperability of AMQPs. It is based on queue-interop
Stars: ✭ 124 (+726.67%)
Mutual labels:  queue, amqp
cloudenvoy
Cross-application messaging for Ruby and Rails using Google Cloud Pub/Sub
Stars: ✭ 31 (+106.67%)
Mutual labels:  pubsub, google-pubsub
pubsub cli
super handy google cloud Pub/Sub CLI
Stars: ✭ 32 (+113.33%)
Mutual labels:  pubsub, cloud-pubsub
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (+9000%)
Mutual labels:  queue, messaging
jobs
RoadRunner: Background PHP workers, Queue brokers
Stars: ✭ 59 (+293.33%)
Mutual labels:  queue, amqp
Yii2 Async
Provides translucent api & queues for moving large tasks out of request context with SQL, Redis or AMQP.
Stars: ✭ 64 (+326.67%)
Mutual labels:  queue, amqp
Laravel Queue Rabbitmq
RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
Stars: ✭ 1,175 (+7733.33%)
Mutual labels:  queue, amqp

Build Status GitHub release GitHub license

gobroker

wrapper for all (to-be) kinds of message brokers (go v1.16.x)

Supported message brokers & patterns

PubSub

  • RabbitMQ (fanout)
  • Google Cloud Pub/Sub
  • NSQ

Intentions & Features

  • Generic terms & functions to use message brokers
  • Auto reconnection
  • Limit & requeue messages*
  • Concurrent subscribers
  • Support for mockgen unit-testing

Install

# go get
$ go get github.com/febytanzil/gobroker

Usage

Complete examples are provided in examples folder/ package

RabbitMQ

// initialize publisher RabbitMQ
p := pubsub.NewPublisher(gobroker.RabbitMQ, pubsub.RabbitMQAMQP("amqp://guest:guest@localhost:5672/", "vhost"))

p.Publish("test.fanout", "msg"+t.String())
// register RabbitMQ subscriber(s) & run it
s := pubsub.NewSubscriber(gobroker.RabbitMQ, []*pubsub.SubHandler{
    {
        Name:        "test.consumer",
        Topic:       "test.fanout",
        Handler:     testRMQ,
        MaxRequeue:  10,
        Concurrent:  2,
        MaxInFlight: 3,
    },
}, pubsub.RabbitMQAMQP("amqp://guest:guest@localhost:5672/", "vhost"))

s.Start()

Google

// initialize publisher Google
p := pubsub.NewPublisher(gobroker.Google, pubsub.GoogleJSONFile("gcp-project-id", "cluster-name", "/path/to/google/application/credentials/cred.json"))

p.Publish("test", "msg"+t.String())
// register Google subscriber(s) & run it
s := pubsub.NewSubscriber(gobroker.Google, []*pubsub.SubHandler{
        {
            Name:        "consumer-test",
            Topic:       "test-topic",
            Handler:     testGoogle,
            MaxRequeue:  10,
            Concurrent:  3,
            Timeout:     10 * time.Minute,
            MaxInFlight: 1,
        },
    },
    pubsub.GoogleJSONFile("gcp-project-id", "cluster-name", "/path/to/google/application/credentials/cred.json"))
		
s.Start()

Creating subcriber/ consumer

// subcriber function format
// return nil will ack the message as success
// return error will requeue based on config

func testRMQ(msg *gobroker.Message) error {
    var encoded string
    
    gobroker.StdJSONCodec.Decode(msg.Body, &encoded)
    log.Println("consume rabbitmq:", encoded)
    
    return nil
}
func testGoogle(msg *gobroker.Message) error {
    var encoded string
    
    gobroker.StdJSONCodec.Decode(msg.Body, &encoded)
    log.Println("consume google pubsub", encoded)
    
    return errors.New("requeue msg body: " + encoded)
}

Notes

Due to requeue limiter, the behavior both in RabbitMQ & Google Pub/Sub is changed to republish to the topic with additional header that contains counter to make this possible

Contributing

Please use a fork to create a pull request

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].