Publish legacy events using Kyma Eventing

Kyma Eventing also supports sending and receiving of legacy events. In this tutorial we will show how to send legacy events.

NOTE: It is recommended to use CloudEvents specification for sending and receiving events in Kyma.

Prerequisites

  1. Follow the Prerequisites steps for the Eventing tutorials.
  2. Create a Function.

Create a Subscription

To subscribe to events, we need a Subscription custom resource. We're going to subscribe to events of the type order.received.v1.

  • Kyma Dashboard
  • kubectl

Publish a legacy event to trigger the workload

You created the lastorder Function, and subscribed to the order.received.v1 events by creating a Subscription CR. Now it's time to send an event and trigger the Function.

  1. Port-forward the Event Publisher Proxy Service to localhost, using port 3000. Run:
    Click to copy
    kubectl -n kyma-system port-forward service/eventing-event-publisher-proxy 3000:80
  2. Publish an event to trigger your Function. In another terminal window, run:

    Click to copy
    curl -v -X POST \
    --data @<(<<EOF
    {
    "event-type": "order.received",
    "event-type-version": "v1",
    "event-time": "2020-09-28T14:47:16.491Z",
    "data": {"orderCode":"3211213"}
    }
    EOF
    ) \
    -H "Content-Type: application/json" \
    http://localhost:3000/myapp/v1/events

    NOTE: If you want to use a Function to publish a CloudEvent, see the Event object SDK specification.

Verify the legacy event delivery

To verify that the event was properly delivered, check the logs of the Function (see Verify the event delivery).

You see the received event in the logs:

Click to copy
Received event: { orderCode: '3211213' }