Este contenido no está disponible en el idioma seleccionado.
Chapter 11. Subscribing functions to CloudEvents
			You can subscribe a function to a set of events. This links your function to CloudEvent objects defined by your filters and enables automated responses.
		
11.1. Subscribing a function to CloudEvents
				The subscribe command connects the function to a set of events, matching a series of filters for CloudEvent metadata and a Knative Broker as the source of events, from where they are consumed.
			
Prerequisites
- You have installed Knative Eventing on the cluster.
- You have configured a Knative Broker.
- 
						You have installed the Knative (kn) CLI.
Procedure
- Subscribe the function to events for a given broker by running the following command: - Example command - kn func subscribe --filter type=com.example.Hello --source my-broker - $ kn func subscribe --filter type=com.example.Hello --source my-broker- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Use the - --sourceflag to specify the broker and one or more- --filterflags to specify your filters.- You can also omit the - --sourceflag to use the default broker:- Example command - kn func subscribe --filter type=com.example --filter extension=my-extension-value - $ kn func subscribe --filter type=com.example --filter extension=my-extension-value- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Deploy the function with Knative Triggers: - Example command - kn func deploy - $ kn func deploy- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - 🙌 Function image built: <registry>/hello:latest 🎯 Creating Triggers on the cluster ✅ Function deployed in namespace "default" and exposed at URL: http://hello.default.my-cluster.example.com - 🙌 Function image built: <registry>/hello:latest 🎯 Creating Triggers on the cluster ✅ Function deployed in namespace "default" and exposed at URL: http://hello.default.my-cluster.example.com- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow