rscpulsar

package module
v0.0.0-...-e24ef45 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 5 Imported by: 0

README

resource-pulsar

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

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

func (*Consumer) Close

func (c *Consumer) Close(_ context.Context) error

Close will close the consumer and wait for the Listen to finish

func (*Consumer) Listen

func (c *Consumer) Listen(ctx context.Context) error

Listen performs the

func (*Consumer) Name

func (c *Consumer) Name() string

type Option

type Option func(*Resource)

Option are modifications that will be applied to the resource.

func WithCustomPulsarConfig

func WithCustomPulsarConfig(f func(opts *pulsar.ClientOptions)) Option

WithCustomPulsarConfig allows you to change the pulsar.ClientOptions before the client is created. If you need a config that is not supported by the rscpulsar package, you can use this option to apply your own config.

type PlatformConfig

type PlatformConfig struct {
	URL      string   `config:"url,secret"`
	Timeouts Timeouts `config:"timeouts"`
}

type Resource

type Resource struct {
	Client pulsar.Client
	// contains filtered or unexported fields
}

func New

func New(cfg PlatformConfig, opts ...Option) *Resource

New builds a new services.Resource for connecting to an Apache Pulsar server.

func (*Resource) Name

func (r *Resource) Name() string

func (*Resource) Start

func (r *Resource) Start(_ context.Context) error

func (*Resource) Stop

func (r *Resource) Stop(_ context.Context) error

Stop stops the resource using the default pulsar.Client.Close method.

func (*Resource) Subscribe

func (r *Resource) Subscribe(cfg SubscriptionPlatformConfig, handler consume.MessageHandler, opts ...consume.Option) (*Consumer, error)

type SubscriptionPlatformConfig

type SubscriptionPlatformConfig struct {
	Name             string   `config:"name"`
	SubscriptionName string   `config:"subscription_name,required"`
	Topic            string   `config:"topic"`
	Topics           []string `config:"topics"`
	TopicsPattern    string   `config:"topics_pattern"`
}

type Timeouts

type Timeouts struct {
	Connection time.Duration `config:"connection"`
	Operation  time.Duration `config:"operation"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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