Skip to content

Commit 9b5acad

Browse files
authored
Merge pull request #22407 from abrennan89/subs
Create subscription docs + deadlettersink for Serverless
2 parents a2515f3 + f74c95e commit 9b5acad

File tree

5 files changed

+77
-4
lines changed

5 files changed

+77
-4
lines changed

_topic_map.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,6 +2371,9 @@ Topics:
23712371
# Channels
23722372
- Name: Using channels
23732373
File: serverless-channels
2374+
# Subscriptions
2375+
- Name: Using subscriptions to send events from a channel to a sink
2376+
File: serverless-subscriptions
23742377
# Triggers
23752378
- Name: Using triggers
23762379
File: serverless-kn-trigger
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Module included in the following assemblies:
2+
//
3+
// <List assemblies here, each on a new line>
4+
// * serverless/knative_eventing/serverless-subscriptions.adoc
5+
6+
[id="serverless-creating-subscriptions_{context}"]
7+
= Creating a subscription
8+
9+
You can create a subscription to connect a service or other event sink to a channel.
10+
11+
[IMPORTANT]
12+
====
13+
Knative Eventing is a Technology Preview feature. The InMemoryChannel type is provided for development use only, and should not be used in a production environment.
14+
====
15+
16+
.Prerequisites
17+
18+
* You must have a current installation of xref:../../serverless/installing_serverless/installing-openshift-serverless.adoc#serverless-install-web-console_installing-openshift-serverless[{ServerlessProductName}], including Knative Serving and Eventing, in your {product-title} cluster. This can be installed by a cluster administrator.
19+
* If you do not have an existing sink that you wish to use, create a Service to use as a sink by following the documentation on xref:../../serverless/serving-creating-managing-apps.adoc#serving-creating-managing-apps[Creating and managing serverless applications].
20+
* You must have a channel to connect your subscription to. See xref:../../serverless/knative_eventing/serverless-channels.adoc#serverless-channels[Using channels with Knative Eventing].
21+
22+
.Procedure
23+
24+
. Create a Subscription object to connect a channel to a service, by creating a YAML file containing the following:
25+
+
26+
[source,yml]
27+
----
28+
apiVersion: messaging.knative.dev/v1beta1
29+
kind: Subscription
30+
metadata:
31+
name: my-subscription <1>
32+
namespace: default
33+
spec:
34+
channel: <2>
35+
apiVersion: messaging.knative.dev/v1beta1
36+
kind: Channel
37+
name: example-channel
38+
delivery: <3>
39+
deadLetterSink:
40+
ref:
41+
apiVersion: serving.knative.dev/v1
42+
kind: Service
43+
name: error-handler
44+
subscriber: <4>
45+
ref:
46+
apiVersion: serving.knative.dev/v1
47+
kind: Service
48+
name: event-display
49+
----
50+
+
51+
<1> Name of the subscription.
52+
<2> Configuration settings for the channel that the subscription connects to.
53+
<3> Configuration settings for event delivery. This tells the subscription what happens to events that cannot be delivered to the subscriber. When this is configured, events that failed to be consumed are sent to the `deadLetterSink`. The event is dropped, no re-delivery of the event is attempted, and an error is logged in the system. The `deadLetterSink` value must be a link:https://pkg.go.dev/knative.dev/pkg/apis/duck/v1?tab=doc#Destination[Destination].
54+
<4> Configuration settings for the subscriber. This is the event sink that events are delivered to from the channel.
55+
56+
. Apply the YAML file by entering:
57+
+
58+
----
59+
$ oc apply -f <FILENAME>
60+
----

modules/serverless-inmemorychannel.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The following are limitations of InMemoryChannel type channels:
1111

1212
* No event persistence is available. If a Pod goes down, events on that Pod are lost.
1313
* InMemoryChannel type channels do not implement event ordering, so two events that are received in the channel at the same time can be delivered to a subscriber in any order.
14-
* If a subscriber rejects an event, there are no re-delivery attempts. Instead, the rejected event is sent to a `deadLetterSink` if this sink exists, or is otherwise dropped.
15-
// add link to subscription docs after rebase on top of this
14+
* If a subscriber rejects an event, there are no re-delivery attempts. Instead, the rejected event is sent to a `deadLetterSink` if this sink exists, or is otherwise dropped. For more information about configuring event delivery and `deadLetterSink` settings for a channel, see xref:../../serverless/knative_eventing/serverless-subscriptions.adoc#serverless-subscriptions[Using subscriptions to send events from a channel to a sink].
15+
1616
When you install Knative Eventing, the following custom resource definition (CRD) is created automatically:
1717

1818
[source,yaml]

serverless/knative_eventing/serverless-channels.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include::modules/common-attributes.adoc[]
77
toc::[]
88

99
It is possible to sink events from an event source to a Knative Eventing channel.
10-
Channels are Custom Resources (CRs) that define a single event-forwarding and persistence layer.
10+
Channels are custom resources (CRs) that define a single event-forwarding and persistence layer.
1111
After events have been sent to a channel, these events can be sent to multiple Knative services by using a subscription.
1212

1313
The default configuration for channel instances is defined in the `default-ch-webhook` ConfigMap. However, developers can still create their own channels directly by instantiating a supported channel object.
@@ -17,4 +17,3 @@ The default configuration for channel instances is defined in the `default-ch-we
1717
Currently, {ServerlessProductName} only supports the use of InMemoryChannel type channels as part of the Knative Eventing Technology Preview.
1818

1919
include::modules/serverless-inmemorychannel.adoc[leveloffset=+1]
20-
// TODO: Add docs for Kafka channels; separate Jira issue
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include::modules/serverless-document-attributes.adoc[]
2+
[id="serverless-subscriptions"]
3+
= Using subscriptions to send events from a channel to a sink
4+
:context: serverless-subscriptions
5+
include::modules/common-attributes.adoc[]
6+
7+
toc::[]
8+
9+
Subscriptions deliver events to event sinks from a Channel.
10+
11+
include::modules/serverless-creating-subscriptions.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)