Closed yididiyag closed 2 months ago
PR Description:
This PR introduces support for filter-based invocation of OpenFaaS functions using annotations. Key updates include:
Filter Annotations:
filter-[topic]
filter-all
Backward Compatibility:
Key-Handling Logic:
This feature enhances control over function invocation, facilitating complex workflows and payload content management.
Scenario 1: Success Partially Fulfilling with OR & (ignoring invalid quantityx key )
Payload:
{ "id": "check?firstName=Gonzalo&lastName=GERESANO ESCRIBANO&dateOfBirth=1974-02-28&nationality=Mexico", "ref": "box", "quantityx": "8" }
Logs:
{"@l":"info","@m":"Received body","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","body":"{\r \"id\":\"check?firstName=Gonzalo\u0026lastName=GERESANO ESCRIBANO\u0026dateOfBirth=1974-02-28\u0026nationality=Mexico\",\r \"ref\":\"box\",\r \"quantityx\": \"8\"\r}"} {"@l":"info","@m":"Starting invocation for topic","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","topic":"sanction.screen.check"} {"@l":"info","@m":"GetCachedValues","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","functions":["sanction-screen-api"],"topic":"sanction.screen.check"} {"@l":"info","@m":"Found topic-specific filter","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","filter":"quantity \u003e=0 || ref == \"boy\" || id.Contains(\"Gonzalo\")","topic":"sanction.screen.check"} {"@l":"info","@m":"Applying cached filter for function","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","cachedFilter":"quantity \u003e=0 || ref == \"boy\" || id.Contains(\"Gonzalo\")","function":"sanction-screen-api"} {"@l":"warning","@m":"Key not found in payload, skipping condition","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","condition":"quantity \u003e=0"} {"@l":"info","@m":"Condition did not match","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","condition":"ref == \"boy\""} {"@l":"info","@m":"Condition matched","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","condition":"id.Contains(\"Gonzalo\")"} {"@l":"info","@m":"Invocation succeeded","@t":"2024-09-06T11:33:52Z","Application":"rabbitmq-connector","function":"sanction-screen-api"}
Scenario 2: No Match (invalid quantityx, ref was expecting boy, there is no Gonzalo in Id)
{ "id": "check?firstName=John&lastName=Doe&dateOfBirth=1990-01-01&nationality=USA", "ref": "box", "quantityx": "5" }
{"@l":"info","@m":"Received body","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","body":"{\r \"id\":\"check?firstName=John\u0026lastName=Doe\u0026dateOfBirth=1990-01-01\u0026nationality=USA\",\r \"ref\":\"box\",\r \"quantityx\": \"5\"\r}"} {"@l":"info","@m":"Starting invocation for topic","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","topic":"sanction.screen.check"} {"@l":"info","@m":"GetCachedValues","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","functions":["sanction-screen-api"],"topic":"sanction.screen.check"} {"@l":"info","@m":"Found topic-specific filter","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","filter":"quantity \u003e=0 || ref == \"boy\" || id.Contains(\"Gonzalo\")","topic":"sanction.screen.check"} {"@l":"info","@m":"Applying cached filter for function","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","cachedFilter":"quantity \u003e=0 || ref == \"boy\" || id.Contains(\"Gonzalo\")","function":"sanction-screen-api"} {"@l":"info","@m":"Condition matched","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","condition":"quantity \u003e=0"} {"@l":"info","@m":"Condition did not match","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","condition":"ref == \"boy\""} {"@l":"info","@m":"Condition did not match","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","condition":"id.Contains(\"Gonzalo\")"} {"@l":"info","@m":"Invocation failed","@t":"2024-09-06T11:34:26Z","Application":"rabbitmq-connector","function":"sanction-screen-api"}
Scenario 3: Match two Conditions (skipping invalid quantityx key)
{ "id": "check?firstName=Gonzalo&lastName=Gonzalez&dateOfBirth=1980-05-15&nationality=Argentina", "ref": "boy", "quantityx": "10" }
{"@l":"info","@m":"Received body","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","body":"{\r \"id\":\"check?firstName=Gonzalo\u0026lastName=Gonzalez\u0026dateOfBirth=1980-05-15\u0026nationality=Argentina\",\r \"ref\":\"boy\",\r \"quantityx\": \"10\"\r}"} {"@l":"info","@m":"Starting invocation for topic","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","topic":"sanction.screen.check"} {"@l":"info","@m":"GetCachedValues","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","functions":["sanction-screen-api"],"topic":"sanction.screen.check"} {"@l":"info","@m":"Found topic-specific filter","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","filter":"quantity \u003e=0 || ref == \"boy\" || id.Contains(\"Gonzalo\")","topic":"sanction.screen.check"} {"@l":"info","@m":"Applying cached filter for function","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","cachedFilter":"quantity \u003e=0 || ref == \"boy\" || id.Contains(\"Gonzalo\")","function":"sanction-screen-api"} {"@l":"info","@m":"Condition matched","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","condition":"quantity \u003e=0"} {"@l":"info","@m":"Condition matched","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","condition":"ref == \"boy\""} {"@l":"info","@m":"Condition matched","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","condition":"id.Contains(\"Gonzalo\")"} {"@l":"info","@m":"Invocation succeeded","@t":"2024-09-06T11:35:40Z","Application":"rabbitmq-connector","function":"sanction-screen-api"}
Scenario 4: All Matching Conditions with quantity >= 0
quantity >= 0
{ "id": "check?firstName=Gonzao&lastName=GERESANO ESCRIBANO&dateOfBirth=1974-02-28&nationality=Mexico", "ref": "box", "quantity": "8" }
{"@l":"info","@m":"Received body","@t":"2024-09-06T11:59:04Z","Application":"rabbitmq-connector","body":"{\r \"id\":\"check?firstName=Gonzao\u0026lastName=GERESANO ESCRIBANO\u0026dateOfBirth=1974-02-28\u0026nationality=Mexico\",\r \"ref\":\"box\",\r \"quantity\": \"8\"\r}"} {"@l":"info","@m":"Starting invocation for topic","@t":"2024-09-06T11:59:04Z","Application":"rabbitmq-connector","topic":"sanction.screen.check"} {"@l":"info","@m":"GetCachedValues","@t":"2024-09-06T11:59:04Z","Application":"rabbitmq-connector","functions":["sanction-screen-api"],"topic":"sanction.screen.check"} {"@l":"info","@m":"Found topic-specific filter","@t":"2024-09-06T11:59:04Z","Application":"rabbitmq-connector","filter":"quantity \u003e=0 || ref == \"boy\" || id.Contains(\"Gonzalo\")","topic":"sanction.screen.check"} {"@l":"info","@m":"Applying cached filter for function","@t":"2024-09-06T11:59:04Z","Application":"rabbitmq-connector","cachedFilter":"quantity \u003e=0 || ref == \"boy\" || id.Contains(\"Gonzalo\")","function":"sanction-screen-api"} {"@l":"info","@m":"Invocation succeeded","@t":"2024-09-06T11:59:06Z","Application":"rabbitmq-connector","duration":2.668114667,"function":"sanction-screen-api","response":"{\n \"isSanctioned\": false,\n \"message\": \"This person is not on the sanctions list.\"\n}","status":200,"timestamp":"2024-09-06T11:59:06Z"}
@yididiyag I assume this was opened by accident
yes there was a forked repository that I was working on, yes sorry this was by mistake. thanks.
PR Description:
This PR introduces support for filter-based invocation of OpenFaaS functions using annotations. Key updates include:
Filter Annotations:
filter-[topic]
andfilter-all
.Backward Compatibility:
Key-Handling Logic:
This feature enhances control over function invocation, facilitating complex workflows and payload content management.
Scenario 1: Success Partially Fulfilling with OR & (ignoring invalid quantityx key )
Payload:
Logs:
Scenario 2: No Match (invalid quantityx, ref was expecting boy, there is no Gonzalo in Id)
Payload:
Logs:
Scenario 3: Match two Conditions (skipping invalid quantityx key)
Payload:
Logs:
Scenario 4: All Matching Conditions with
quantity >= 0
Payload:
Logs: