eventhub

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package eventhub provides methods to interact, publish and consume events from Azure Eventhub

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns new client

func NewEventHubWithAvro

func NewEventHubWithAvro(config *AvroWithEventhubConfig, logger log.Logger) (pubsub.PublisherSubscriber, error)

NewEventHubWithAvro initialize EventHub with Avro when EventHubConfig and AvroConfig are right

Types

type AvroWithEventhubConfig

type AvroWithEventhubConfig struct {
	EventhubConfig Config
	AvroConfig     avro.Config
}

AvroWithEventhubConfig combines the Azure Eventhub configuration and Avro configuration.

type Config

type Config struct {
	Namespace        string
	EventhubName     string
	ClientID         string
	ClientSecret     string
	TenantID         string
	SharedAccessName string
	SharedAccessKey  string
	// Offsets is slice of Offset in which "PartitionID" and "StartOffset"
	// are the field needed to be set to start consuming from specific offset
	Offsets           []Offset
	ConnRetryDuration int
}

Config contains configuration options for interacting with Azure Eventhub.

type Eventhub

type Eventhub struct {
	Config
	// contains filtered or unexported fields
}

Eventhub represents a client to interact with Azure Eventhub.

func (*Eventhub) Bind

func (e *Eventhub) Bind(message []byte, target interface{}) error

Bind parses the encoded data and stores the result in the value pointed to by target

func (*Eventhub) CommitOffset

func (e *Eventhub) CommitOffset(pubsub.TopicPartition)

CommitOffset not implemented for Eventhub

func (*Eventhub) HealthCheck

func (e *Eventhub) HealthCheck() types.Health

HealthCheck returns the health of the PubSub

func (*Eventhub) IsSet

func (e *Eventhub) IsSet() bool

IsSet checks whether eventhub is initialized or not

func (*Eventhub) Ping

func (e *Eventhub) Ping() error

Ping checks for the health of eventhub, returns an error if it is down

func (*Eventhub) PublishEvent

func (e *Eventhub) PublishEvent(key string, value interface{}, headers map[string]string) (err error)

PublishEvent publishes the event to eventhub

func (*Eventhub) PublishEventWithOptions

func (e *Eventhub) PublishEventWithOptions(key string, value interface{}, _ map[string]string,
	_ *pubsub.PublishOptions) (err error)

PublishEventWithOptions publishes message to eventhub. Ability to provide additional options described in PublishOptions struct

func (*Eventhub) Subscribe

func (e *Eventhub) Subscribe() (*pubsub.Message, error)

Subscribe read messages from eventhub configured

func (*Eventhub) SubscribeWithCommit

func (e *Eventhub) SubscribeWithCommit(pubsub.CommitFunc) (*pubsub.Message, error)

SubscribeWithCommit calls the CommitFunc after subscribing message from eventhub and based on the return values decides whether to commit message and consume another message

type Offset

type Offset struct {
	PartitionID string
	StartOffset string
}

Offset specifies the partition and starting offset for consuming events.

Jump to

Keyboard shortcuts

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