Knative Eventing code samples
Use the following code samples to help you understand the various use cases for Knative Eventing and Event Sources. Learn more about Knative Eventing and Eventing Sources.
See all Knative code samples in GitHub.
Name | Description | Languages |
---|---|---|
Hello World | A quick introduction that highlights how to deploy an app using Knative. | Go and Python |
CloudAuditLogsSource | Configure a CloudAuditLogsSource resource to read data from Cloud Audit Logs and directly publish to the underlying transport (Pub/Sub), in CloudEvents format. | YAML |
CloudPubSubSource | Configure a CloudPubSubSource that fires a new event each time a message is published on a Cloud Pub/Sub topic. This source sends events using a Push-compatible format. | YAML |
CloudSchedulerSource | Configure a CloudSchedulerSource resource for receiving scheduled events from Google Cloud Scheduler. | YAML |
CloudStorageSource | Configure a CloudStorageSource resource to deliver Object Notifications for when a new object is added to Google Cloud Storage (GCS). | YAML |
GitHub source | Shows how to wire GitHub events for consumption by a Knative Service. | YAML |
GitLab source | Shows how to wire GitLab events for consumption by a Knative Service. | YAML |
Apache Kafka Binding | KafkaBinding is responsible for injecting Kafka bootstrap connection information into a Kubernetes resource that embed a PodSpec (as spec.template.spec ). This enables easy bootstrapping of a Kafka client. | YAML |
Apache Kafka Channel | Install and configure the Apache Kafka Channel as the default Channel configuration for Knative Eventing. | YAML |
ResetOffset | Only supported by the Distributed KafkaChannel implementation. The ResetOffset custom resource definition (CRD) exposes the ability to manipulate the location of the ConsumerGroup Offsets in the event stream of a given Knative Subscription. Without the ResetOffset CRD, you must manually stop ConsumerGroups and manipulate the Offsets. | YAML |
Writing an event source using JavaScript | This tutorial provides instructions to build an event source in JavaScript and implement it with a ContainerSource or SinkBinding. | JavaScript |
Parallel with multiple cases | Create a Parallel with two branches. | YAML |
Parallel with mutually exclusive cases | Create a Parallel with mutually exclusive branches. | YAML |