Documentation ¶
Index ¶
Constants ¶
const ( // EventArrivalTime is used to access the metadata stored on a // CloudEvent to measure the time difference between when an event is // received on a broker and before it is dispatched to the trigger function. // The format is an RFC3339 time in string format. For example: 2019-08-26T23:38:17.834384404Z. EventArrivalTime = "knativearrivaltime" )
Variables ¶
var ErrIncomplete = errors.New("incomplete config")
ErrIncomplete is the error when a broker entry exists in the configmap but its decouple queue is nil or empty. This should never happen unless there is a bug in the controller.
var ErrNotFound = errors.New("not found")
ErrNotFound is the error when a broker doesn't exist in the configmap. This can happen if the clients specifies invalid broker in the path, or the configmap volume hasn't been updated.
var ErrNotReady = errors.New("not ready")
ErrNotReady is the error when a broker is not ready.
var HandlerSet wire.ProviderSet = wire.NewSet( NewHandler, clients.NewHTTPMessageReceiver, wire.Bind(new(HttpMessageReceiver), new(*kncloudevents.HttpMessageReceiver)), NewMultiTopicDecoupleSink, wire.Bind(new(DecoupleSink), new(*multiTopicDecoupleSink)), clients.NewPubsubClient, metrics.NewIngressReporter, )
HandlerSet provides a handler with a real HTTPMessageReceiver and pubsub MultiTopicDecoupleSink.
Functions ¶
func NewMultiTopicDecoupleSink ¶
func NewMultiTopicDecoupleSink(ctx context.Context, brokerConfig config.ReadonlyTargets, client *pubsub.Client) *multiTopicDecoupleSink
NewMultiTopicDecoupleSink creates a new multiTopicDecoupleSink.
Types ¶
type DecoupleSink ¶
type DecoupleSink interface { // Send sends the event from a broker to the corresponding decoupling sink. Send(ctx context.Context, broker types.NamespacedName, event cev2.Event) protocol.Result }
DecoupleSink is an interface to send events to a decoupling sink (e.g., pubsub).
type Handler ¶ added in v0.15.0
type Handler struct {
// contains filtered or unexported fields
}
Handler receives events and persists them to storage (pubsub).
func NewHandler ¶
func NewHandler(ctx context.Context, httpReceiver HttpMessageReceiver, decouple DecoupleSink, reporter *metrics.IngressReporter) *Handler
NewHandler creates a new ingress handler.
func (*Handler) ServeHTTP ¶ added in v0.15.0
func (h *Handler) ServeHTTP(response nethttp.ResponseWriter, request *nethttp.Request)
ServeHTTP implements net/http Handler interface method. 1. Performs basic validation of the request. 2. Parse request URL to get namespace and broker. 3. Convert request to event. 4. Send event to decouple sink.