Skip to content

Commit 2871099

Browse files
committed
Adding event delivery parameter docs
1 parent 34c898c commit 2871099

12 files changed

+287
-21
lines changed

_topic_map.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,15 +2842,21 @@ Topics:
28422842
- Name: Splitting traffic between revisions
28432843
File: splitting-traffic-between-revisions-knative
28442844
# Knative Eventing
2845-
- Name: Event workflows
2845+
- Name: Knative Eventing workflows
28462846
Dir: event_workflows
28472847
Topics:
28482848
# Brokers
2849-
- Name: Event delivery workflows using brokers and triggers
2849+
- Name: Broker and trigger workflows
28502850
File: serverless-using-brokers
28512851
# Channels
2852-
- Name: Event delivery workflows using channels
2852+
- Name: Channel workflows
28532853
File: serverless-channels
2854+
# Subscriptions
2855+
- Name: Using subscriptions
2856+
File: serverless-subs
2857+
# Event delivery
2858+
- Name: Event delivery
2859+
File: serverless-event-delivery
28542860
# Event sources
28552861
- Name: Event sources
28562862
Dir: event_sources

modules/serverless-creating-subscriptions-kn.adoc

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * serverless/event_workflows/serverless-channels.adoc
3+
// * serverless/event_workflows/serverless-subs.adoc
44

55
[id="serverless-creating-subscriptions-kn_{context}"]
66
= Creating subscriptions using the Knative CLI
@@ -17,16 +17,21 @@ To create subscriptions using the `kn` CLI, ensure that:
1717

1818
.Procedure
1919

20-
* Create a subscription to connect a sink to a channel.
20+
* Create a subscription to connect a sink to a channel:
2121
+
2222
[source,terminal]
2323
----
2424
$ kn subscription create <subscription_name> \
25-
--channel <Group:Version:Kind>:<channel_name> \
26-
--sink <sink_prefix>:<sink_name> \
27-
--sink-reply <sink_prefix>:<sink_name> \
28-
--sink-dead-letter <sink_prefix>:<sink_name>
29-
----
25+
--channel <group:version:kind>:<channel_name> \ <1>
26+
--sink <sink_prefix>:<sink_name> \ <2>
27+
--sink-dead-letter <sink_prefix>:<sink_name> <3>
28+
----
29+
<1> `--channel` specifies the source for cloud events that should be processed. You must provide the channel name. If you are not using the default `InMemoryChannel` channel that is backed by the `Channel` resource, you must prefix the channel name with the `<group:version:kind>` for the specified channel type. For example, this will be `messaging.knative.dev:v1beta1:KafkaChannel` for a Kafka backed channel.
30+
<2> `--sink` specifies the target destination to which the event should be delivered. By default, the `<sink_name>` is interpreted as a Knative service of this name, in the same namespace as the subscription. You can specify the type of the sink by using one of the following prefixes:
31+
`ksvc`:: A Knative service.
32+
`channel`:: A channel that should be used as destination. Only default channel types can be referenced here.
33+
`broker`:: An Eventing broker.
34+
<3> Optional: `--sink-dead-letter` is an optional flag that can be used to specify a sink which events should be sent to in cases where events fail to be delivered. For more information, see the {ServerlessProductName} _Event delivery_ documentation.
3035
+
3136
.Example command
3237
[source,terminal]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/event_workflows/serverless-subs.adoc
4+
5+
[id="serverless-deleting-subscriptions-kn_{context}"]
6+
= Deleting subscriptions using the Knative CLI
7+
8+
You can delete a subscription by using the `kn` CLI.
9+
10+
.Procedure
11+
12+
* Delete a subscription:
13+
+
14+
[source,terminal]
15+
----
16+
$ kn subscription delete <subscription_name>
17+
----
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/event_workflows/serverless-subs.adoc
4+
5+
[id="serverless-describe-subs-kn_{context}"]
6+
= Describing subscriptions using the Knative CLI
7+
8+
You can print information about a subscription in the terminal by using the `kn` CLI.
9+
10+
.Prerequisites
11+
12+
To describe subscriptions using the `kn` CLI, ensure that:
13+
14+
* You have installed the `kn` CLI.
15+
* You have created a subscription in your cluster.
16+
17+
.Procedure
18+
19+
* Describe a subscription:
20+
+
21+
[source,terminal]
22+
----
23+
$ kn subscription describe <subscription_name>
24+
----
25+
+
26+
.Example output
27+
[source,terminal]
28+
----
29+
Name: my-subscription
30+
Namespace: default
31+
Annotations: messaging.knative.dev/creator=openshift-user, messaging.knative.dev/lastModifier=min ...
32+
Age: 43s
33+
Channel: Channel:my-channel (messaging.knative.dev/v1)
34+
Subscriber:
35+
URI: http://edisplay.default.example.com
36+
Reply:
37+
Name: default
38+
Resource: Broker (eventing.knative.dev/v1)
39+
DeadLetterSink:
40+
Name: my-sink
41+
Resource: Service (serving.knative.dev/v1)
42+
43+
Conditions:
44+
OK TYPE AGE REASON
45+
++ Ready 43s
46+
++ AddedToChannel 43s
47+
++ ChannelReady 43s
48+
++ ReferencesResolved 43s
49+
----
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Module included in the following assemblies:
2+
//
3+
// serverless/event_workflows/serverless-event-delivery.adoc
4+
5+
[id="serverless-event-delivery-component-behaviors_{context}"]
6+
= Event delivery behavior for Knative Eventing channels
7+
8+
Different Knative Eventing channel types have their own behavior patterns that are followed for event delivery. Developers can set event delivery parameters in the subscription configuration to ensure that any events that fail to be delivered from channels to an event sink are retried. You must also configure a dead letter sink for subscriptions if you want to provide a sink where events that are not eventually delivered can be stored, otherwise undelivered events are dropped.
9+
10+
== Event delivery behavior for Apache Kafka channels
11+
12+
If an event is successfully delivered to a Kafka channel or broker receiver, the receiver responds with a `202` status code, which means that the event has been safely stored inside a Kafka topic and is not lost. If the receiver responds with any other status code, the event is not safely stored, and steps must be taken by the user to resolve this issue.
13+
14+
== Delivery failure status codes
15+
16+
The channel or broker receiver can respond with the following status codes if an event fails to be delivered:
17+
18+
`500`:: This is a generic status code which means that the event was not delivered successfully.
19+
`404`:: This status code means that the channel or broker the event is being delivered to does not exist, or that the `Host` header is incorrect.
20+
`400`:: This status code means that the event being sent to the receiver is invalid.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/event_workflows/serverless-subs.adoc
4+
5+
[id="serverless-list-subs-kn_{context}"]
6+
= Listing subscriptions using the Knative CLI
7+
8+
You can list existing subscriptions on your cluster by using the `kn` CLI.
9+
10+
.Prerequisites
11+
12+
* You have installed the `kn` CLI.
13+
14+
.Procedure
15+
16+
* List subscriptions on your cluster:
17+
+
18+
[source,terminal]
19+
----
20+
$ kn subscription list
21+
----
22+
+
23+
.Example output
24+
[source,terminal]
25+
----
26+
NAME CHANNEL SUBSCRIBER REPLY DEAD LETTER SINK READY REASON
27+
mysubscription Channel:mychannel ksvc:event-display True
28+
----
29+
// . Optional: List subscriptions in YAML format:
30+
// +
31+
// [source,terminal]
32+
// ----
33+
// $ kn subscription list -o yaml
34+
// ----
35+
// Add this step once I have an example output, optional so non urgent
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Module included in the following assemblies:
2+
//
3+
// serverless/event_workflows/serverless-event-delivery.adoc
4+
5+
[id="serverless-subscription-event-delivery-config_{context}"]
6+
= Configuring event delivery failure parameters using subscriptions
7+
8+
Developers can configure event delivery parameters for individual subscriptions by modifying the `delivery` settings for a `Subscription` object.
9+
10+
.Example subscription YAML
11+
[source,yaml]
12+
----
13+
apiVersion: messaging.knative.dev/v1
14+
kind: Subscription
15+
metadata:
16+
name: <subscription_name>
17+
namespace: <subscription_namespace>
18+
spec:
19+
delivery:
20+
deadLetterSink: <1>
21+
ref:
22+
apiVersion: serving.knative.dev/v1
23+
kind: Service
24+
name: <sink_name>
25+
backoffDelay: <duration> <2>
26+
backoffPolicy: <policy_type> <3>
27+
retry: <integer> <4>
28+
----
29+
<1> Configuration settings to enable using a dead letter sink. This tells the subscription what happens to events that cannot be delivered to the subscriber.
30+
+
31+
When this is configured, events that fail to be delivered are sent to the dead letter sink destination. The destination can be a Knative service or a URI.
32+
<2> You can set the `backoffDelay` delivery parameter to specify the time delay before an event delivery retry is attempted after a failure. The duration of the `backoffDelay` parameter is specified using the https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO 8601] format. For example, `PT1S` specifies a 1 second delay.
33+
<3> The `backoffPolicy` delivery parameter can be used to specify the retry back off policy. The policy can be specified as either `linear` or `exponential`. When using the `linear` back off policy, the back off delay is the time interval specified between retries. When using the `exponential` back off policy, the back off delay is equal to `backoffDelay*2^<numberOfRetries>`.
34+
<4> The number of times that event delivery is retried before the event is sent to the dead letter sink.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/event_workflows/serverless-subs.adoc
4+
5+
[id="serverless-update-subscriptions-kn_{context}"]
6+
= Updating subscriptions
7+
8+
You can update a subscription by using the `kn` CLI.
9+
10+
.Prerequisites
11+
12+
To update subscriptions using the `kn` CLI, ensure that:
13+
14+
* The {ServerlessOperatorName} and Knative Eventing are installed on your {product-title} cluster.
15+
* You have installed the `kn` CLI.
16+
* You have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.
17+
* You have created a subscription.
18+
19+
.Procedure
20+
21+
* Update a subscription:
22+
+
23+
[source,terminal]
24+
----
25+
$ kn subscription update <subscription_name> \
26+
--sink <sink_prefix>:<sink_name> \ <1>
27+
--sink-dead-letter <sink_prefix>:<sink_name> <2>
28+
----
29+
<1> `--sink` specifies the updated target destination to which the event should be delivered. You can specify the type of the sink by using one of the following prefixes:
30+
`ksvc`:: A Knative service.
31+
`channel`:: A channel that should be used as destination. Only default channel types can be referenced here.
32+
`broker`:: An Eventing broker.
33+
<2> Optional: `--sink-dead-letter` is an optional flag that can be used to specify a sink which events should be sent to in cases where events fail to be delivered. For more information, see the {ServerlessProductName} _Event delivery_ documentation.
34+
+
35+
.Example command
36+
[source,terminal]
37+
----
38+
$ kn subscription update mysubscription --sink ksvc:event-display
39+
----

serverless/event_workflows/serverless-channels.adoc

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include::modules/serverless-document-attributes.adoc[]
22
[id="serverless-channels"]
3-
= Event delivery workflows using channels
3+
= Channel workflows
44
include::modules/common-attributes.adoc[]
55
:context: serverless-channels
66

@@ -39,14 +39,10 @@ These events can then be forwarded to an event sink by using subscriptions.
3939

4040
include::modules/serverless-connect-channel-source-odc.adoc[leveloffset=+2]
4141

42-
[id="serverless-channels-creating-subs"]
43-
== Creating subscriptions
44-
45-
Developers can create subscriptions that allow event sinks to subscribe to channels and receive events directly.
42+
// deleting channels
43+
include::modules/serverless-delete-channel-kn.adoc[leveloffset=+1]
4644

47-
include::modules/serverless-creating-subscriptions-odc.adoc[leveloffset=+2]
48-
include::modules/serverless-creating-subscriptions-kn.adoc[leveloffset=+2]
49-
include::modules/serverless-creating-subscriptions-yaml.adoc[leveloffset=+2]
45+
[id="serverless-channels-next-steps"]
46+
== Next steps
5047

51-
// delete channels
52-
include::modules/serverless-delete-channel-kn.adoc[leveloffset=+1]
48+
* After you have created a channel, see xref:../../serverless/event_workflows/serverless-subs.adoc#serverless-subs[Using subscriptions] for information about creating and using subscriptions for event delivery.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
include::modules/serverless-document-attributes.adoc[]
2+
[id="serverless-event-delivery"]
3+
= Event delivery
4+
include::modules/common-attributes.adoc[]
5+
:context: serverless-event-delivery
6+
7+
toc::[]
8+
9+
You can configure event delivery parameters for Knative Eventing that are applied in cases where an event fails to be delivered by a xref:../../serverless/event_workflows/serverless-subs.adoc#serverless-subs[subscription]. Event delivery parameters are configured individually per subscription.
10+
// TODO: Update docs to add triggers once this is implemented.
11+
12+
include::modules/serverless-event-delivery-component-behaviors.adoc[leveloffset=+1]
13+
14+
[id="serverless-event-delivery-parameters"]
15+
== Configurable parameters
16+
17+
The following parameters can be configured for event delivery.
18+
19+
Dead letter sink:: You can configure the `deadLetterSink` delivery parameter so that if an event fails to be delivered it is sent to the specified event sink.
20+
21+
Retries:: You can set a minimum number of times that the delivery must be retried before the event is sent to the dead letter sink, by configuring the `retry` delivery parameter with an integer value.
22+
23+
Back off delay:: You can set the `backoffDelay` delivery parameter to specify the time delay before an event delivery retry is attempted after a failure. The duration of the `backoffDelay` parameter is specified using the https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO 8601] format.
24+
25+
Back off policy:: The `backoffPolicy` delivery parameter can be used to specify the retry back off policy. The policy can be specified as either `linear` or `exponential`. When using the `linear` back off policy, the back off delay is the time interval specified between retries. When using the `exponential` backoff policy, the back off delay is equal to `backoffDelay*2^<numberOfRetries>`.
26+
27+
include::modules/serverless-subscription-event-delivery-config.adoc[leveloffset=+1]
28+
29+
[id="serverless-event-delivery-additional-resources"]
30+
== Additional resources
31+
32+
* See xref:../../serverless/event_workflows/serverless-channels.adoc#serverless-channels[Knative Eventing workflows using channels] for more information about subscriptions.
33+
* See xref:../../serverless/event_workflows/serverless-subs.adoc#serverless-subs-creating-subs[Creating subscriptions].

0 commit comments

Comments
 (0)