Documentation ¶
Index ¶
- Constants
- Variables
- func AddFinalizer(c *eventingv1alpha1.Channel, finalizerName string)
- func ChannelDispatcherServiceName(ccpName string) string
- func ChannelHostName(channelName, namespace string) string
- func ChannelServiceName(channelName string) string
- func ChannelVirtualServiceName(channelName string) string
- func CreateDispatcherService(ctx context.Context, client runtimeClient.Client, ...) (*corev1.Service, error)
- func CreateK8sService(ctx context.Context, client runtimeClient.Client, c *eventingv1alpha1.Channel) (*corev1.Service, error)
- func CreateVirtualService(ctx context.Context, client runtimeClient.Client, ...) (*istiov1alpha3.VirtualService, error)
- func DispatcherLabels(ccpName string) map[string]string
- func NewLoggingConfig() *logging.Config
- func NewProvisionerLoggerFromConfig(config *logging.Config) *zap.SugaredLogger
- func RemoveFinalizer(c *eventingv1alpha1.Channel, finalizerName string)
- func UpdateChannel(ctx context.Context, client runtimeClient.Client, u *eventingv1alpha1.Channel) error
- func UpdateClusterChannelProvisionerStatus(ctx context.Context, client runtimeClient.Client, ...) error
- type ChannelReference
- type DispatchDefaults
- type Message
- type MessageDispatcher
- type MessageReceiver
Constants ¶
const ( PortName = "http" PortNumber = 80 )
const (
MessageReceiverPort = 8080
)
MessageReceiver starts a server to receive new messages for the channel dispatcher. The new message is emitted via the receiver function.
Variables ¶
var ErrUnknownChannel = errors.New("unknown channel")
ErrUnknownChannel is returned when a message is received by a channel dispatcher for a channel that does not exist.
Functions ¶
func AddFinalizer ¶
func AddFinalizer(c *eventingv1alpha1.Channel, finalizerName string)
func ChannelDispatcherServiceName ¶ added in v0.2.1
func ChannelHostName ¶ added in v0.2.1
func ChannelServiceName ¶ added in v0.2.1
func ChannelVirtualServiceName ¶ added in v0.2.1
func CreateDispatcherService ¶
func CreateDispatcherService(ctx context.Context, client runtimeClient.Client, ccp *eventingv1alpha1.ClusterChannelProvisioner) (*corev1.Service, error)
func CreateK8sService ¶
func CreateK8sService(ctx context.Context, client runtimeClient.Client, c *eventingv1alpha1.Channel) (*corev1.Service, error)
func CreateVirtualService ¶
func CreateVirtualService(ctx context.Context, client runtimeClient.Client, channel *eventingv1alpha1.Channel) (*istiov1alpha3.VirtualService, error)
func DispatcherLabels ¶
func NewLoggingConfig ¶
NewLoggingConfig creates a static logging configuration appropriate for a provisioner. All logging levels are set to Info.
func NewProvisionerLoggerFromConfig ¶
func NewProvisionerLoggerFromConfig(config *logging.Config) *zap.SugaredLogger
NewProvisionerLoggerFromConfig creates a new zap logger for the provisioner component based on the provided configuration
func RemoveFinalizer ¶
func RemoveFinalizer(c *eventingv1alpha1.Channel, finalizerName string)
func UpdateChannel ¶
func UpdateChannel(ctx context.Context, client runtimeClient.Client, u *eventingv1alpha1.Channel) error
func UpdateClusterChannelProvisionerStatus ¶
func UpdateClusterChannelProvisionerStatus(ctx context.Context, client runtimeClient.Client, u *eventingv1alpha1.ClusterChannelProvisioner) error
Types ¶
type ChannelReference ¶ added in v0.2.1
ChannelReference references a Channel within the cluster by name and namespace.
func ParseChannel ¶ added in v0.2.1
func ParseChannel(host string) ChannelReference
ParseChannel converts the channel's hostname into a channel reference.
func (*ChannelReference) String ¶ added in v0.2.1
func (r *ChannelReference) String() string
type DispatchDefaults ¶ added in v0.2.1
type DispatchDefaults struct {
Namespace string
}
DispatchDefaults provides default parameter values used when dispatching a message.
type Message ¶ added in v0.2.1
type Message struct { // Headers provide metadata about the message payload. All header keys // should be lowercase. Headers map[string]string // Payload is the raw binary content of the message. The payload format is // often described by the 'content-type' header. Payload []byte }
Message represents an chunk of data within a channel dispatcher. The message contains both a map of string headers and a binary payload.
A message may represent a CloudEvent.
type MessageDispatcher ¶ added in v0.2.1
type MessageDispatcher struct {
// contains filtered or unexported fields
}
MessageDispatcher dispatches messages to a destination over HTTP.
func NewMessageDispatcher ¶ added in v0.2.1
func NewMessageDispatcher(logger *zap.SugaredLogger) *MessageDispatcher
NewMessageDispatcher creates a new message dispatcher that can dispatch messages to HTTP destinations.
func (*MessageDispatcher) DispatchMessage ¶ added in v0.2.1
func (d *MessageDispatcher) DispatchMessage(message *Message, destination, reply string, defaults DispatchDefaults) error
DispatchMessage dispatches a message to a destination over HTTP.
The destination and reply are DNS names. For names with a single label, the default namespace is used to expand it into a fully qualified name within the cluster.
type MessageReceiver ¶ added in v0.2.1
type MessageReceiver struct {
// contains filtered or unexported fields
}
func NewMessageReceiver ¶ added in v0.2.1
func NewMessageReceiver(receiverFunc func(ChannelReference, *Message) error, logger *zap.SugaredLogger) *MessageReceiver
NewMessageReceiver creates a message receiver passing new messages to the receiverFunc.
func (*MessageReceiver) HandleRequest ¶ added in v0.2.1
func (r *MessageReceiver) HandleRequest(res http.ResponseWriter, req *http.Request)
HandleRequest is an http Handler function. The request is converted to a Message and emitted to the receiver func.
The response status codes:
202 - the message was sent to subscibers 404 - the request was for an unknown channel 500 - an error occurred processing the request
func (*MessageReceiver) Run ¶ added in v0.2.1
func (r *MessageReceiver) Run(stopCh <-chan struct{})
Run starts receiving messages for the receiver.
Only HTTP POST requests to the root path (/) are accepted. If other paths or methods are needed, use the HandleRequest method directly with another HTTP server.
This method will block until a message is received on the stop channel.