Skip to content

Latest commit

 

History

History
58 lines (35 loc) · 1.67 KB

simpledelivery.md

File metadata and controls

58 lines (35 loc) · 1.67 KB

Simple Delivery

In Knative Eventing, you typically use Broker and Trigger to receive and filter messages. However, there are other simpler and more complex delivery models.

Let's take a look at the simple delivery scenario where an Event Source sends messages directly to a Service:

Simple Delivery

Service

First, create the Knative Service that will be the target of our event.

Define service.yaml.

It's a Knative Service that simply logs out received messages.

Create the service:

kubectl apply -f service.yaml

Source

Knative supports a number of Event Sources to read all sorts of events in Knative.

For this example, let's use Ping Source, an in-memory Event Source that fires events based on given cron schedule:

Define source.yaml:

It sends a message every minute to an event sink, which is a Knative Service in this case.

Create the source:

kubectl apply -f source.yaml

Verify

Check the running pods:

kubectl get pods

NAME                                                              READY STATUS    RESTARTS   AGE
cronjobsource-source-3c465b71-4bbe-4611-a816-a73a75cf8681-66ps5   1/1     Running   0          2m54s
service-x25xg-deployment-55f957448-rtljx                          2/2     Running   0          2m57s

Check the logs of the service. You should see messages from the CronJobSource:

kubectl logs service-x25xg-deployment-55f957448-rtljx -c user-container

info: event_display.Startup[0]
      Event Display received event: {"message":"Hello world from cron!"}