Giter Site home page Giter Site logo

queue_proxy's Introduction

queue_proxy

  • 支持redis/kafka/aliyun mns多种消息服务引擎,
  • 统一发送/消费方式,接口简易(http restful/tcp)
  • 瞬时切换后端消息服务(灾备切换)
  • 多服务智能负载均衡调度

producer端

  • 本地disk queue做消息服务灾备,避免消息丢失,并支持数据压缩
  • 队列级别限流控制及合理内存检测, 避免后端消息服务过载

consumer端

  • 屏蔽后端不同消息服务引擎消费方式的差异化
  • 动态调整实际消费worker,低峰期避免空跑
  • 针对redis queue增加message ack功能
  • 增加delay queue支持(redis/kafka)

安装使用

  go get github.com/jmuyuyang/queue_proxy

配置说明

  queue:
    - 
      name: "hlg-kafka"
      type: kafka
      attr:
        bind: 172.16.2.216:9092
        timeout: 3
        pool_size: 5
    -
      name: "hlg-redis"
      type: redis
      attr:
        bind: 127.0.0.1:6379
        timeout: 3
        pool_size: 5
  disk:
    path: "./data"
    flush_timeout: 2
    compress_type: "gzip" //文件压缩方式

使用说明

    import queue "github.com/jmuyuyang/queue_proxy"
    val config queue.QueueConfig
    config = queue.ParseConfigFile(cfgFile)
    queue.NewQueueProducer(config)
	queue.InitQueue("producer-name","topic-name","hlg-redis")
    queue.Start()

    queue.SendMessage(dateByte)
    queue.SetRateLimit(ratePerSecond) //限制限流(每秒流速)
    queue.Stop()
	
    queue.NewQueueConsumer(config)
    queue.InitQueue("hlg-kafka","logcenter")
    queue.Start()
    msg := <-queue.GetMessageChan()

queue_proxy's People

Contributors

gaoding-yuyang avatar jmuyuyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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