Subscribe functions to CloudEvents

Prerequisites

  • Knative Eventing installed on the cluster

Procedure

The subscribe command will connect the function to a set of events, matching a series of filters for Cloud Event metadata and a Knative Broker as the source of events, from where they are consumed.

funckn func

To subscribe the function to events for a given broker, run the following command:

  1. func subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker

To subscribe the function to events for the default broker, run the following command:

  1. func subscribe --filter type=com.example --filter extension=my-extension-value

To subscribe the function to events for a given broker, run the following command:

  1. kn func subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker

To subscribe the function to events for the default broker, run the following command:

  1. kn func subscribe --filter type=com.example --filter extension=my-extension-value

Deployment with Triggers

When invoking func deploy the CLI will create Knative Triggers for the function.

funckn func

Deploy the function with Triggers by running the command inside the project directory:

  1. func deploy

Deploy the function with Triggers by running the command inside the project directory:

  1. kn func deploy

Expected output

  1. 🙌 Function image built: <registry>/hello:latest
  2. 🎯 Creating Triggers on the cluster
  3. Function deployed in namespace "default" and exposed at URL:
  4. http://hello.default.127.0.0.1.sslip.io