bus

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IpIntToString

func IpIntToString(ipInt uint32) string

func IpStringToInt

func IpStringToInt(ipstring string) uint32

func ParseBusID

func ParseBusID(ipstring string) (uint32, uint32, uint32, uint32, uint32)

Types

type BusImplRabbitMQ

type BusImplRabbitMQ struct {
	// contains filtered or unexported fields
}

func NewBusImplRabbitMQ

func NewBusImplRabbitMQ(selfBusId uint32, onRecvMsg MsgHandler, rabbitmqAddr string) *BusImplRabbitMQ

func (*BusImplRabbitMQ) SelfBusId

func (b *BusImplRabbitMQ) SelfBusId() uint32

func (*BusImplRabbitMQ) Send

func (b *BusImplRabbitMQ) Send(dstBusId uint32, data1 []byte, data2 []byte) error

func (*BusImplRabbitMQ) SetReceiver

func (b *BusImplRabbitMQ) SetReceiver(onRecvMsg MsgHandler)

type IBus

type IBus interface {
	SelfBusId() uint32
	Send(dstBusId uint32, data1 []byte, data2 []byte) error

	// 默认规则:
	// 1. onRecvMsg由实现类的内部协程调用,且只会由一个协程调用。
	// 2. data的所有权,转交给onRecvMsg。
	// 如有例外,实现类需特殊说明。
	SetReceiver(onRecvMsg MsgHandler)
}

需保证协程并发安全

func CreateBus

func CreateBus(implType string, selfBusId uint32, onRecvMsg MsgHandler, args ...interface{}) IBus

implType : args "rabbitmq": (rabbitmqAddr string)

type MsgHandler

type MsgHandler func(srcBusID uint32, data []byte)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL