Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus is a local event bus that delegates handling of published events to all matching registered handlers, in order of registration.
func NewEventBus ¶
func NewEventBus(projectID string, config *SubscriberConfig, opts ...option.ClientOption) (*EventBus, error)
NewEventBus creates an EventBus with optional GCP connection settings
func NewEventBusWithClient ¶
func NewEventBusWithClient(config *SubscriberConfig, client *pubsub.Client) (*EventBus, error)
NewEventBusWithClient created and EventBus with provided config and client
func (*EventBus) AddHandler ¶
func (b *EventBus) AddHandler(ctx context.Context, m eh.EventMatcher, h eh.EventHandler) error
AddHandler implements the AddHandler method of the eventhorizon.EventBus interface.
func (*EventBus) Errors ¶
func (b *EventBus) Errors() <-chan eh.EventBusError
Errors implements the Errors method of the eventhorizon.EventBus interface.
func (*EventBus) HandleEvent ¶
HandleEvent implements the HandleEvent method of the eventhorizon.EventBus interface.
func (*EventBus) HandlerType ¶
func (b *EventBus) HandlerType() eh.EventHandlerType
HandlerType implements the HandlerType method of the eventhorizon.EventBus interface.
type Muxer ¶
type Muxer interface { // Handle registers the handler function for the given pattern. Handle(pattern string, handlerFunc http.Handler) // ServeHTTP dispatches the requests to the appropriate handler // whose method matches the request method and whose patter most // closely matches the request URL. ServeHTTP(http.ResponseWriter, *http.Request) }
Muxer is a HTTP request multiplexer that can be used if you need
func NewDefaultMuxer ¶
NewDefaultMuxer returns a muxer implementation that forwards requests starting with "/_ah/push-handlers" to this muxer, but all other requests to handler. If handler is nil, nothing will happen.
type Option ¶
Option is an option setter used to configure creation.
func WithCodec ¶
func WithCodec(codec eh.EventCodec) Option
WithCodec uses the specified codec for encoding events.
type SubscriberConfig ¶
type SubscriberConfig struct {
// contains filtered or unexported fields
}
SubscriberConfig is a configuration for push subscribers
func NewDefaultSubscriberConfig ¶
func NewDefaultSubscriberConfig(appID, host, schema string, mux Muxer) *SubscriberConfig
func NewSubscriberConfig ¶
func NewSubscriberConfig(appID, host, schema, endpointBase string, mux Muxer) *SubscriberConfig
func (*SubscriberConfig) Endpoint ¶
func (c *SubscriberConfig) Endpoint(typ string) string
func (*SubscriberConfig) SubscriberID ¶
func (c *SubscriberConfig) SubscriberID(typ string) string