83
83
broker: default
84
84
filter:
85
85
attributes:
86
- type: greeting # <1>
86
+ type: aloha # <1>
87
87
subscriber:
88
88
ref:
89
89
apiVersion: serving.knative.dev/v1
@@ -98,12 +98,14 @@ Now create the the trigger for `eventingaloha` that will associate the filtered
98
98
:service-file: trigger-helloaloha.yaml
99
99
:trigger-name: helloaloha
100
100
:trigger-sub-name: eventingaloha
101
+ :trigger-event: aloha
101
102
=== Create Aloha Trigger
102
103
include::eventing:partial$deploy-knative-resources.adoc[tags=tab-1;eventing-trigger-sub;tab-2]
103
104
104
105
:service-file: trigger-hellobonjour.yaml
105
106
:trigger-name: hellobonjour
106
107
:trigger-sub-name: eventingbonjour
108
+ :trigger-event: bonjour
107
109
=== Create Bonjour Trigger
108
110
Now create the the trigger for `eventingbonjour` that will associate the filtered events to a service:
109
111
@@ -124,39 +126,7 @@ include::eventing:partial$knative-objects.adoc[tag=knative-triggers]
124
126
[#eventing-trigger-verification]
125
127
== Verification
126
128
127
- Pull out the subscriberUri for `eventhingaloha`:
128
-
129
- [#eventing-triggers-verify-sub1]
130
- [.console-input]
131
- [source,bash,subs="+macros,+attributes"]
132
- ----
133
- kubectl get trigger helloaloha -o jsonpath='{.status.subscriberUri}'
134
- ----
135
-
136
- The command should show the output as:
137
- [.console-output]
138
- [source,bash]
139
- ----
140
- http://eventingaloha.knativetutorial.svc.cluster.local
141
- ----
142
-
143
- Pull out the subscriberUri for `eventhingbonjour`:
144
-
145
- [#eventing-triggers-verify-sub2]
146
- [.console-input]
147
- [source,bash,subs="+macros,+attributes"]
148
- ----
149
- kubectl get trigger hellobonjour -o jsonpath='{.status.subscriberUri}'
150
- ----
151
-
152
- The command should show the output as:
153
- [.console-output]
154
- [source,bash]
155
- ----
156
- http://eventingbonjour.knativetutorial.svc.cluster.local
157
- ----
158
-
159
- As well as broker's subscriberUri:
129
+ Pull out the broker URI:
160
130
161
131
[#eventing-triggers-verify-sub3]
162
132
[.console-input]
@@ -172,7 +142,7 @@ The command should show the output as:
172
142
http://broker-ingress.knative-eventing.svc.cluster.local/{tutorial-namespace}/default
173
143
----
174
144
175
- You should notice that the subscriberURIs are Kubernetes services with the suffix of `{tutorial-namespace}.svc.cluster.local`. This means they can be interacted with from another pod within the Kubernetes cluster.
145
+ You should notice that the broker URI is a Kubernetes services with the suffix of `{tutorial-namespace}.svc.cluster.local`. This means they can be interacted with from another pod within the Kubernetes cluster.
176
146
177
147
Now that you have setup the Broker and Triggers you need to send in some test messages to see the behavior.
178
148
@@ -221,12 +191,12 @@ Exec into the `curler` pod:
221
191
kubectl -n {tutorial-namespace} exec -it curler -- /bin/bash
222
192
----
223
193
224
- Using the `curler` pod's shell, curl the subcriberURI for eventingaloha:
194
+ Using the `curler` pod's shell, curl the broker URI for eventingaloha:
225
195
226
196
[.console-input]
227
197
[source,bash,subs="+macros,+attributes"]
228
198
----
229
- curl -v "http://eventingaloha .{tutorial-namespace}.svc.cluster.local" \
199
+ curl -v "http://broker-ingress .{tutorial-namespace}.svc.cluster.local" \
230
200
-X POST \
231
201
-H "Ce-Id: say-hello" \
232
202
-H "Ce-Specversion: 1.0" \
@@ -255,12 +225,12 @@ curler 1/1 Running 59s
255
225
eventingaloha-1-deployment-6cdc888d9d-9xnnn 2/2 Running 30s
256
226
-----
257
227
258
- Next, curl the subcriberURI for `eventingbonjour`:
228
+ Next, curl the broker URI for `eventingbonjour`:
259
229
260
230
[.console-input]
261
231
[source,bash,subs="+macros,+attributes"]
262
232
----
263
- curl -v "http://eventingbonjour .{tutorial-namespace}.svc.cluster.local" \
233
+ curl -v "http://broker-ingress .{tutorial-namespace}.svc.cluster.local" \
264
234
-X POST \
265
235
-H "Ce-Id: say-hello" \
266
236
-H "Ce-Specversion: 1.0" \
@@ -290,46 +260,7 @@ eventingaloha-1-deployment-6cdc888d9d-9xnnn 2/2 Running 53s
290
260
eventingbonjour-1-deployment-fc7858b5b-s9prj 2/2 Running 5s
291
261
-----
292
262
293
- Now, trigger both `eventingaloha` and `eventingbonjour` by curling the subcriberURI for the broker:
294
-
295
- [#trigger-verify-trigger-all]
296
- [.console-input]
297
- [source,bash,subs="+macros,+attributes"]
298
- ----
299
- curl -v "http://broker-ingress.knative-eventing.svc.cluster.local/{tutorial-namespace}/default" \
300
- -X POST \
301
- -H "Ce-Id: say-hello" \
302
- -H "Ce-Specversion: 1.0" \
303
- -H "Ce-Type: greeting" \
304
- -H "Ce-Source: mycurl" \
305
- -H "Content-Type: application/json" \
306
- -d '{"key":"from a curl"}'
307
- ----
308
-
309
- [NOTE]
310
- ====
311
- "Ce-Type: greeting" is the key to insuring that both aloha and bonjour respond to this event
312
- ====
313
-
314
- And by watching the *{tutorial-namespace}* namespace, you will see both `eventingaloha` and `eventingbonjour` will come to life:
315
-
316
- [#trigger-watch-all-scale]
317
- [.console-input]
318
- [source,bash,subs="+macros,+attributes"]
319
- -----
320
- watch kubectl get pods
321
- -----
322
-
323
- The command above should show the following output:
324
-
325
- [.console-output]
326
- [source,bash]
327
- -----
328
- NAME READY STATUS AGE
329
- curler 1/1 Running 3m21s
330
- eventingaloha-1-deployment-6cdc888d9d-nlpm8 2/2 Running 6s
331
- eventingbonjour-1-deployment-fc7858b5b-btdcr 2/2 Running 6s
332
- -----
263
+ It was verified how each payload configured with either `type: aloha` or `type: bonjour` sent to the broker, then each trigger was able to filter each incoming message and send to the designated service set in the trigger.
333
264
334
265
You can experiment by using different type filters in the Subscription to see how the different subscribed services respond. `Filters` may use an link:https://cloudevents.io/[CloudEvent] attribute for its criteria.
335
266
0 commit comments