Documentation ¶
Overview ¶
The package implements a minimal set of Azure Event Hubs functionality.
We could use https://github.com/Azure/azure-event-hubs-go but it's too huge and also it has a number of dependencies that aren't desired in the project.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckMessageResponse ¶
func CheckMessageResponse(msg *amqp.Message) error
CheckMessageResponse checks for 200 response code otherwise returns an error.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an EventHub client.
func DialConnectionString ¶
DialConnectionString dials an EventHub instance using the given connection string.
func (*Client) Subscribe ¶
func (c *Client) Subscribe( ctx context.Context, fn func(event *Event) error, opts ...SubscribeOption, ) error
Subscribe subscribes to all hub's partitions and registers the given handler and blocks until it encounters an error or the context is cancelled.
Non-nil errors returned from fn reject AMQP messages.
type Credentials ¶
Credentials is an evenhub connection string representation.
func ParseConnectionString ¶
func ParseConnectionString(cs string) (*Credentials, error)
ParseConnectionString parses the given connection string into Credentials structure.
type Event ¶
type Event struct { *amqp.Message // contains filtered or unexported fields }
Event is an Event Hub event, simply wraps an AMQP message.
type Option ¶
type Option func(c *Client)
Option is a client configuration option.
func WithConnOption ¶
func WithConnOption(opt amqp.ConnOption) Option
WithConnOption sets a low-level connection option.
func WithSASLPlain ¶
WithSASLPlain configures connection username and password.
func WithTLSConfig ¶
WithTLSConfig sets connection TLS configuration.
type SubscribeOption ¶
type SubscribeOption func(r *sub)
SubscribeOption is a Subscribe option.
func WithSubscribeConsumerGroup ¶
func WithSubscribeConsumerGroup(name string) SubscribeOption
WithSubscribeConsumerGroup overrides default consumer group, default is `$Default`.
func WithSubscribeLinkOption ¶
func WithSubscribeLinkOption(opt amqp.LinkOption) SubscribeOption
WithSubscribeLinkOption is a low-level subscription configuration option.
func WithSubscribeSince ¶
func WithSubscribeSince(t time.Time) SubscribeOption
WithSubscribeSince requests events that occurred after the given time.