Giter Club home page Giter Club logo

gf-x-rabbitmq's Introduction

GF 的 rabbit MQ 接入

西安豆芽科技有限公司

package main

import (
	"github.com/xgd16/gf-x-rabbitMQ/rabbitMQ"
	"github.com/xgd16/gf-x-rabbitMQ/types"
)

func main() {
  // 发送队列
  // param1 队列名称
  // param2 参数
  // param3 是否持久化数据 (会降低QPS)
  rabbitMQ.SendQueue("TestQueue", g.Map{"a":1}, false)
  // 监听处理
  rabbitMQ.QueueService(map[string]error{
	  "测试队列": rabbitMQ.CreateConsumerHandler(&types.RegisterHandler[types.TestQueueData]{
		  Handler:    handlers.TestQueue, // 执行的函数
		  TaskName:   "TestQueue",        // 订阅的任务名称
		  SyncNum:    30,                 // 同时运行的携程数
		  FieldNames: []string{"age"},    // 基于哪些字段进行单线程限制
	  }),
  })
}

gf-x-rabbitmq's People

Contributors

xgd16 avatar

Watchers

 avatar

gf-x-rabbitmq's Issues

question

  1. "测试队列": rabbitMQ.CreateConsumerHandler(&types.RegisterHandler[types.TestQueueData]{
    Unresolved type 'TestQueueData'

  2. Handler: handlers.TestQueue, // 执行的函数

This composite literal allocates a new struct instance with the given values.
You may either specify the field values in order or use their names.

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.