pulsar

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConsumerElementKey = micro.ElementKey("PulsarConsumerComponent")

ConsumerElementKey pulsar消息队列消费者模块

View Source
var ProducerElementKey = micro.ElementKey("PulsarProducerComponent")

ProducerElementKey pulsar消息队列生产者模块

Functions

func SetDefaultConfig

func SetDefaultConfig()

SetDefaultConfig -

Types

type Config

type Config struct {
	Enable bool   `toml:"enable"`
	URL    string `toml:"url"`
	Topic  string `toml:"topic"`
}

Config .

func GetConfig

func GetConfig() *Config

GetConfig -

type Consumer

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

Consumer pulsar消费者客户端

func NewConsumer

func NewConsumer(url string, topic string) (*Consumer, error)

NewConsumer . url pulsar://localhost:6600,localhost:6650 topic 主题

func (*Consumer) Close

func (c *Consumer) Close() error

Close .

func (*Consumer) ReceiverChannel

func (c *Consumer) ReceiverChannel(out chan<- []byte)

ReceiverChannel 接收通道内数据

type ConsumerComponent

type ConsumerComponent struct {
	micro.EmptyComponent
	// contains filtered or unexported fields
}

ConsumerComponent pulsar消费者模块

func (*ConsumerComponent) Init

func (c *ConsumerComponent) Init(server *micro.Server) error

Init the component

func (*ConsumerComponent) Name

func (c *ConsumerComponent) Name() string

Name of the component

func (*ConsumerComponent) PostStop

func (c *ConsumerComponent) PostStop(ctx context.Context) error

PostStop called after Stop()

func (*ConsumerComponent) PreInit

func (c *ConsumerComponent) PreInit(ctx context.Context) error

PreInit called before Init()

type Producer

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

Producer pulsar 生产者客户端

func NewProducer

func NewProducer(logger logging.ILogger, url string, topic string) (*Producer, error)

NewProducer . url pulsar://localhost:6600,localhost:6650 topic 主题

func (*Producer) Close

func (c *Producer) Close() error

Close .

func (*Producer) Send

func (c *Producer) Send(data []byte)

Send 发送消息

type ProducerComponent

type ProducerComponent struct {
	micro.EmptyComponent
	// contains filtered or unexported fields
}

ProducerComponent pulsar生产者模块

func (*ProducerComponent) Init

func (c *ProducerComponent) Init(server *micro.Server) error

Init the component

func (*ProducerComponent) Name

func (c *ProducerComponent) Name() string

Name of the component

func (*ProducerComponent) PostStop

func (c *ProducerComponent) PostStop(ctx context.Context) error

PostStop called after Stop()

func (*ProducerComponent) PreInit

func (c *ProducerComponent) PreInit(ctx context.Context) error

PreInit called before Init()

Jump to

Keyboard shortcuts

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