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

    1. Service 'cloudevents-player' created to latest revision 'cloudevents-player-vwybw-1' is available at URL:
    2. http://cloudevents-player.default.${LOADBALANCER_IP}.sslip.io

    Why is my Revision named something different!

    1. Apply the YAML file by running the command:

      1. 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 .

    The user interface for the CloudEvents Player

    What do these fields mean?

    For more information on the CloudEvents Specification, check out the CloudEvents Spec.

    1. Fill in the form with whatever you data you want.
    2. Ensure your Event Source does not contain any spaces.
    3. Click SEND EVENT.

    Clicking the Using a Knative Service as a source - 图4 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:

    1. -H "Content-Type: application/json" \
    2. -H "Ce-Id: 123456789" \
    3. -H "Ce-Specversion: 1.0" \
    4. -H "Ce-Type: some-type" \
    5. -H "Ce-Source: command-line" \

    And to view events:

    The Using a Knative Service as a source - 图6 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!