Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDeadlineExceeded = errors.New("error: deadline exceeded on publish")
ErrDeadlineExceeded is an error that's raised when a deadline occurs
var MaxErrorCount = 50
Functions ¶
Types ¶
type Option ¶
type Option func(config *PublishConfig) error
func WithDeadline ¶
WithDebugOption will turn on debugging
func WithHeaders ¶
WithHeaders will provide an ability to set specific headers on the outgoing HTTP request
type PublishConfig ¶
PublishConfig is used by Options
type PublishEvent ¶
type PublishEvent struct { Object datamodel.Model Headers map[string]string Logger log.Logger `json:"-"` // contains filtered or unexported fields }
PublishEvent is the container for a model event
type Subscription ¶
type Subscription struct { GroupID string `json:"group_id"` Topics []string `json:"topics"` Headers map[string]string `json:"headers"` IdleDuration string `json:"idle_duration"` Limit int `json:"limit"` Offset string `json:"offset"` After int64 `json:"after"` DisableAutoCommit bool `json:"disable_autocommit"` Channel string `json:"-"` APIKey string `json:"-"` BufferSize int `json:"-"` Errors chan<- error `json:"-"` Logger log.Logger `json:"-"` HTTPHeaders map[string]string `json:"-"` }
Subscription is the information for creating a subscription channel to receive events from the event server
type SubscriptionChannel ¶
type SubscriptionChannel struct {
// contains filtered or unexported fields
}
SubscriptionChannel is a channel for receiving events
func NewSubscription ¶
func NewSubscription(ctx context.Context, subscription Subscription) (*SubscriptionChannel, error)
NewSubscription will create a subscription to the event server and will continously read events (as they arrive) and send them back to the return channel. once you're done, you must call Close on the channel to stop receiving events
func (*SubscriptionChannel) Channel ¶
func (c *SubscriptionChannel) Channel() <-chan SubscriptionEvent
Channel returns a read-only channel to receive SubscriptionEvent
func (*SubscriptionChannel) Close ¶
func (c *SubscriptionChannel) Close() error
Close will close the event channel and stop receiving them
func (*SubscriptionChannel) WaitForReady ¶
func (c *SubscriptionChannel) WaitForReady()
WaitForReady will block until we have received the subscription ack
type SubscriptionEvent ¶
type SubscriptionEvent struct { ID string `json:"message_id"` Timestamp time.Time `json:"timestamp"` Headers map[string]string `json:"headers,omitempty"` Key string `json:"key"` Type string `json:"type"` Model string `json:"model"` Data string `json:"object"` // contains filtered or unexported fields }
SubscriptionEvent is received from the event server
func (SubscriptionEvent) Commit ¶
func (e SubscriptionEvent) Commit()
Commit for committing a message when auto commit is false