Categorygithub.com/gisard/amqp-engine
modulepackage
1.0.1
Repository: https://github.com/gisard/amqp-engine.git
Documentation: pkg.go.dev

# README

amqp-engine

amqp-engine is an integrated tool that simplifies AMQP functionality by exposing only the frequently used features and eliminating the need for users to focus on peripheral parameters. Another part of it is an asynchronous message engine: when processing messages with AMQP, users can register a listening queue to handle messages similar to using Gin.

Get

go get -u github.com/gisard/amqp-engine

Goals

  1. Overall section
    • Supports connection and channel disconnection monitoring and reconnection.
    • Simple and easy to use while maintaining the flexibility of AMQP.
    • Suitable for current scenarios.
  2. AMQP Section
    • Supports creating and deleting exchanges and queues freely
    • Supports binding and unbinding freely
    • Supports publishing different types of data, and returns the publishing results
    • Provides low-level AMQP applications when the scenario is more complex
  3. Engine section
    • Autonomous reconnection
    • Error handling mechanism
    • Support for adding middleware
    • Support for grouping function, different groups can use different middleware
    • Support for binding functions of different data types
    • Users can freely control the subscription Ack mechanism

Quick start

# assume the following codes in example.go file
$ cat example/engine.go
package main

import (
	"github.com/gisard/amqp-engine/engine"
)

type testStruct struct {
   Name string `json:"name"`
   Age  int    `json:"age"`
}

func main() {
   e := engine.New("amqp://username:[email protected]:5672/")

   e.Handle("queue", false, func(ctx *engine.Context) error {
      var s1 testStruct
      err := ctx.ShouldBindJson(&s1)
      if err != nil {
         return err
      }
      return nil
   })
   e.run()
}

Example

See the example subdirectory for simple engine executables.

Engine design

Engine design drawing

Future

  1. Flexible support for type configuration, allowing developers to add types and a small amount of configuration to enable parsing of that type.
  2. Engine functionality implementation is pluggable, as long as the underlying implementation has the main functions of Connection and Channel, it can be integrated into the engine.
  3. Added "mustbind" for mandatory validation of bound fields, and "shouldbind" with tag:"binding" for enforced validation control.
  4. Integration with opentelemetry for tracing of access links.

# Packages

No description provided by the author
No description provided by the author

# Functions

New connect to amqp server and return a connection.

# Constants

No description provided by the author
No description provided by the author
Direct exchange.
Fanout exchange.
Headers exchange.
No description provided by the author
No description provided by the author
Topic exchange.
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

Ack is used to Acknowledge consume message.
No description provided by the author
No description provided by the author