Git Product home page Git Product logo

gogo-amqp's Introduction

gogo-amqp

GitHub Actions status

simple amqp client by golang build on top github.com/streadway/amqp


Todo

  • support graceful shutdown
  • support direct produce message
  • support exchange produce message
  • test failed case
  • support cluster nodes
  • autoreconnect connection and channel
  • refactor consumer use client same producer

Limitation

  • support data type only json

Installation

    go get -u github.com/devit-tel/gogo-amqp

Usage

  • create consumer and register queue handler
  • if handler return err gogo-amqp will be send nck and requeue
    	consumer, err := gogo_amqp.NewConsumer("localhost", "/", "guest", "guest", 5672)
	defer consumer.Close()
	if err != nil {
		panic(err)
	}

	consumer.RegisterQueueHandler("test_queue", func(data []byte) error {
        	// implement here
		return nil
	})

	consumer.RegisterQueueHandler("test_queue_x", func(data []byte) error {
        	// implement here
		return nil
	})

	consumer.Start()
  • create producer and produce message to exchange / direct queue
    producer, err := gogo_amqp.NewProducer("localhost", "/", "guest", "guest", 5672)
    if err !=nil {
        panic(err)
    }

    // produce message to exchange
    err = producer.ProduceExchange("test_exchange", jsonData)
    if err != nil {
        panic(err)
    }

    // produce message to direct queue
    err = producer.ProduceQueue("test_queue", jsonData)
    if err != nil {
        panic(err)
    }

gogo-amqp's People

Contributors

zier avatar nqmt avatar

Stargazers

Fikkree Jehsamoh avatar

Watchers

James Cloos avatar Sngmn451 avatar Watchrapong Agsonchu avatar  avatar Suvichan 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.