Using a Knative Service as a source
The above image is Figure 6.6 from Knative in Action.
The CloudEvents Player acts as a Source for CloudEvents by intaking the URL of the Broker as an environment variable, . You will send CloudEvents to the Broker through the CloudEvents Player application.
Create the CloudEvents Player Service:
knYAML
Run the command:
Expected output
Service 'cloudevents-player' created to latest revision 'cloudevents-player-vwybw-1' is available at URL:
http://cloudevents-player.default.${LOADBALANCER_IP}.sslip.io
Why is my Revision named something different!
Apply the YAML file by running the command:
kubectl apply -f cloudevents-player.yaml
Expected output
Examining the CloudEvents Player
You can use the CloudEvents Player to send and receive CloudEvents. If you open the Service URL in your browser, the Create Event form appears.
The Service URL is http://cloudevents-player.default.${LOADBALANCER_IP}.sslip.io
, for example, for .
What do these fields mean?
For more information on the CloudEvents Specification, check out the CloudEvents Spec.
- Fill in the form with whatever you data you want.
- Ensure your Event Source does not contain any spaces.
- Click SEND EVENT.
Clicking the shows you the CloudEvent as the Broker sees it.
Want to send events using the command line instead?
As an alternative to the Web form, events can also be sent/viewed using the command line.
To post an event:
-H "Content-Type: application/json" \
-H "Ce-Id: 123456789" \
-H "Ce-Specversion: 1.0" \
-H "Ce-Type: some-type" \
-H "Ce-Source: command-line" \
And to view events:
The icon in the “Status” column implies that the event has been sent to our Broker… but where has the event gone? Well, right now, nowhere!