Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotReplyable = errors.New("message is not replyable")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Publish publishes a message to a subject
Publish(ctx context.Context, subject string, data []byte, opts ...PublishOption) error
// QueuePublish publishes a message to a subject in a consumer group named queue
QueuePublish(ctx context.Context, subject string, data []byte, opts ...PublishOption) error
// Request requests a message from a subject, and synchronously waits for a reply. All subscribers will receive the message and try to reply. You probably want to use QueueRequest instead.
Request(ctx context.Context, subject string, data []byte, timeout time.Duration, opts ...PublishOption) (Message, error)
// QueueRequest requests a message from a subject in a consumer, and synchronously waits for a reply
QueueRequest(ctx context.Context, subject string, data []byte, timeout time.Duration, opts ...PublishOption) (Message, error)
// Subscribe subscribes to a subject
Subscribe(ctx context.Context, subject string, cb MessageCallback) (Subscriber, error)
// QueueSubscribe subscribes to a subject in a consumer group named queue
QueueSubscribe(ctx context.Context, subject, queue string, cb MessageCallback) (Subscriber, error)
// Close closes the client
Close() error
}
Client defines the interface for event clients
type Headers ¶
Headers represents message headers that can be used for both map operations and propagation
type Message ¶
type Message interface {
Data() []byte
Headers() Headers
Reply(ctx context.Context, data []byte, opts ...PublishOption) error
}
Message represents a message received from the event system
type MessageCallback ¶
type PublishOption ¶
type PublishOption func(*publishOptions)
func WithHeader ¶
func WithHeader(key, value string) PublishOption
type Subscriber ¶
type Subscriber interface {
// Close stops the subscriber
Close() error
}
Click to show internal directories.
Click to hide internal directories.