Open pilhuhn opened 3 years ago
/cc @geoand, @matejvasek, @patriot1burke
Catch-all ability would be great.
This works in 1.13.7: and allows @CloudEventMapping(trigger = "*")
Index: extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/VertxRequestHandler.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>x-MacRoman
===================================================================
diff --git a/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/VertxRequestHandler.java b/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/VertxRequestHandler.java
--- a/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/VertxRequestHandler.java (revision 7bdb007f650a604f589eb44264b4df4800f697c0)
+++ b/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/VertxRequestHandler.java (date 1625492068660)
@@ -149,7 +149,11 @@
if (defaultInvoker != null) {
invoker = defaultInvoker;
} else {
- invoker = typeTriggers.get(ceType);
+ if (typeTriggers.get(ceType) != null) {
+ invoker = typeTriggers.get(ceType);
+ } else {
+ invoker = typeTriggers.get("*"); // Catch all
+ }
if (invoker == null) {
routingContext.fail(404);
log.error("Couldn't map CloudEvent type: '" + ceType + "' to a function.");
@patriot1burke I think this should be closed.
Description
Currently either the method name of a
@Funq
or thetrigger
value is taken to match the type of an incoming cloud event. Sometimes (especially with the new filtering functionality) it is desirable to match on multiple types (e.g. in some kind of audit scenarios).It should be allowed to say
or
*
(1st example) could be seen as "fallback if no better match"In then 2nd example it could be determined if regex-match is desired or not.
Implementation ideas
https://github.com/quarkusio/quarkus/blob/main/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/VertxRequestHandler.java#L162 could get a retry logic a la