events

package
v0.0.0-...-87a4e12 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoPing

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

AutoPing is a helper for automatically pinging events as they are processed.

func (*AutoPing) Add

func (a *AutoPing) Add(event *Event) uint

func (*AutoPing) Remove

func (a *AutoPing) Remove(id uint)

type Client

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

func New

func New(js jetstream.JetStream, logger *slog.Logger) *Client

func (*Client) EnsureConsumer

func (c *Client) EnsureConsumer(ctx context.Context, stream string, opts ...consumers.Option) (consumers.Consumer, error)

func (*Client) EnsureStream

func (m *Client) EnsureStream(ctx context.Context, name string, opts ...streams.Option) (streams.Stream, error)

EnsureStream ensures that a JetStream stream exists with the given configuration. If the stream already exists, it will be updated with the new configuration.

func (*Client) Publish

func (e *Client) Publish(ctx context.Context, event *events.OutgoingEvent) (events.PublishedEvent, error)

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, stream string, consumer string, opts ...subscribe.Option) (<-chan events.Event, error)

type Consumer

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

func (*Consumer) Name

func (c *Consumer) Name() string

type Event

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

func (*Event) Ack

func (e *Event) Ack(ctx context.Context, opts ...events.AckOption) error

func (*Event) Context

func (e *Event) Context() context.Context

func (*Event) DeliveryAttempt

func (e *Event) DeliveryAttempt() uint

func (*Event) Headers

func (e *Event) Headers() events.Headers

func (*Event) ID

func (e *Event) ID() uint64

func (*Event) Ping

func (e *Event) Ping(ctx context.Context, opts ...events.PingOption) error

func (*Event) Reject

func (e *Event) Reject(ctx context.Context, opts ...events.RejectOption) error

func (*Event) Subject

func (e *Event) Subject() string

func (*Event) UnmarshalNew

func (e *Event) UnmarshalNew() (proto.Message, error)

func (*Event) UnmarshalTo

func (e *Event) UnmarshalTo(v proto.Message) error

type PublishedEvent

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

func (*PublishedEvent) ID

func (e *PublishedEvent) ID() uint64

type Stream

type Stream struct{}

Jump to

Keyboard shortcuts

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