Skip to content
Branch: master
Find file History
anishj0shi Change eventing publish urls to the new ones (#139)
w.r.t kyma-project/kyma#4956 certain components from the event-bus have been refactores and this PR proposes changes in the corresponding example references

Changes proposed in this pull request:

Update event-bus-publish.kyma-system:8080 => event-publish-service.kyma-system:8080
Latest commit a581735 Jul 30, 2019

Event Bus Service Subscription


This example demonstrates how to publish and consume Events using the Event Bus with the Event publishing API and push-to-webhook support available in Kyma.


Kyma comes with the NATS Streaming messaging cluster. Instead of interacting with the NATS Streaming cluster directly, use the publish HTTP API and the push subscription support that Kyma offers, to enable basic Event publishing and Event delivery through push notifications to an HTTP endpoint.

Access the Event publishing API from the cluster through the 8080 port on the following hostnames:

  • event-publish-service.kyma-system
  • event-publish-service.kyma-system.svc.cluster.local


  • A Docker installation if modification of the image is necessary.
  • A kubectl installation.
  • Kyma as the target deployment environment.


  1. Export your Namespace as a variable by replacing the {namespace} placeholder in the following command and running it:

    export KYMA_EXAMPLE_NS="{namespace}"
  2. Deploy the example subscriber:

    kubectl apply -f example-subscriber.yaml -n $KYMA_EXAMPLE_NS
  3. Enable the Event activation:

    kubectl apply -f example-event-activation.yaml -n $KYMA_EXAMPLE_NS
  4. Set your Namespace on the subscription endpoint:

    sed -i "s/<namespace>/$KYMA_EXAMPLE_NS/g" example-subscription.yaml
    sed -i '' "s/<namespace>/$KYMA_EXAMPLE_NS/g" example-subscription.yaml

    To manually edit example-subscription.yaml, replace the {namespace} placeholder in the endpoint with your Namespace.

  5. Deploy the example subscription:

    kubectl apply -f example-subscription.yaml -n $KYMA_EXAMPLE_NS
  6. Deploy the example publisher:

    kubectl apply -f example-publisher.yaml -n $KYMA_EXAMPLE_NS
  7. Verify that the example subscriber and publisher Pods are running:

    kubectl get pods -n $KYMA_EXAMPLE_NS

    The system eventually applies EgressRule, which allows the example publisher container to download cURL. Istio grants access and the example publisher Pod starts.

  8. Once the example subscriber and publisher Pods are running, access the example publisher container through SSH:

    kubectl exec -n $KYMA_EXAMPLE_NS $(kubectl get pods -n $KYMA_EXAMPLE_NS -l app=example-publisher --output=jsonpath={}) -c example-publisher -i -t -- sh
  9. Publish a message:

    curl -i \
        -H "Content-Type: application/json" \
        -X POST http://event-publish-service.kyma-system:8080/v1/events \
        -d '{"source-id": "external-application", "event-type": "test-event-bus", "event-type-version": "v1", "event-time": "2018-11-02T22:08:41+00:00", "data": {"event":{"customer":{"customerID": "1234", "uid": ""}}}}'
    # or use the fully-qualified Event publishing API service name
    curl -i \
        -H "Content-Type: application/json" \
        -X POST http://event-publish-service.kyma-system.svc.cluster.local:8080/v1/events \
        -d '{"source-id": "external-application", "event-type": "test-event-bus", "event-type-version": "v1", "event-time": "2018-11-02T22:08:41+00:00", "data": {"event":{"customer":{"customerID": "1234", "uid": ""}}}}'

    NOTE: To send multiple Events, change the orderCode to have a unique value for each POST request.

  10. To access Event attributes compliant with the CloudEvents specification use the following paths for the event object in the request:

    Field JSON path
    ce-specversion event.extensions.request.headers['ce-specversion']
    ce-type event.extensions.request.headers['ce-type']
    ce-source event.extensions.request.headers['ce-source']
    ce-id event.extensions.request.headers['ce-id']
    ce-time event.extensions.request.headers['ce-time']
    ce-eventtypeversion event.extensions.request.headers['ce-eventtypeversion']
    ce-knativehistory event.extensions.request.headers['ce-knativehistory']
    content-type event.extensions.request.headers['content-type']


To view the traces:

  1. Access the tracing UI.
  2. Select event-publish-knative-service.
  3. Click Find Traces.


Exit the example publisher container and perform a cleanup using this command:

kubectl delete all,subscription,eventactivation -l example=event-subscription-service -n $KYMA_EXAMPLE_NS


NATS Streaming does not support topic and subject deletion. Thus, data such as topics and messages from previous runs accumulates if you repeat the installation steps multiple times.

You can’t perform that action at this time.