Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the Publish and Subscribe interfaces
func NewClient ¶
func NewClient(opts *ClientOptions) *Client
NewClient returns a new Firehose client
type ClientOptions ¶
type ClientOptions struct { Group string Consumer string Redis *redis.Client // HandlerTimeout is the duration after which the // context passed to handlers is cancelled. If this // value is zero, a default duration of 30s is applied. HandlerTimeout time.Duration }
ClientOptions contains fields to configure the Firehose client
type Decoder ¶
type Decoder func(v interface{}) error
Decoder is a function that decodes an event into v
type Handler ¶
Handler processes messages received on a channel that has been subscribed to. HandleEvent should return a result that tells the client whether the handling was successful or not.
type HandlerFunc ¶
HandlerFunc is an adapter that allows ordinary functions to be used as event handlers. If f is a function with the appropriate signature, HandlerFunc(f) is a Handler that calls f.
func (HandlerFunc) HandleEvent ¶
func (f HandlerFunc) HandleEvent(ctx context.Context, decode Decoder) Result
HandleEvent calls f(ctx, decode)
type MockClient ¶
type MockClient struct { }
MockClient can be used by unit tests
func (MockClient) Publish ¶
func (m MockClient) Publish(context.Context, string, interface{}) error
Publish does nothing
func (MockClient) Subscribe ¶
func (m MockClient) Subscribe(string, Handler)
Subscribe is not implemented
type Publisher ¶
type Publisher interface { // Publish emits an event to the firehose Publish(ctx context.Context, channel string, message interface{}) error }
Publisher is the interface that wraps the publish method
type Result ¶
Result is an alias for queuer.Result
func Discard ¶
Discard should be returned when the event was not successfully processed but should not be retried
type Subscriber ¶
Subscriber is the interface that wraps the subscribe method