pulsar

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

ConsumerElementKey pulsar message queue consumer module

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

ProducerElementKey pulsar message queue producer module

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 consumer client

func NewConsumer

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

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

func (*Consumer) Close

func (c *Consumer) Close() error

Close .

func (*Consumer) ReceiverChannel

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

ReceiverChannel receive data within the channel

type ConsumerComponent

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

ConsumerComponent pulsar consumer module

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 producer

func NewProducer

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

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

func (*Producer) Close

func (c *Producer) Close() error

Close .

func (*Producer) Send

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

Send send message

type ProducerComponent

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

ProducerComponent pulsar producer module

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