Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike dedicated rest middleware #18485

Closed
wants to merge 11 commits into from
Closed

Conversation

tmetzke
Copy link
Member

@tmetzke tmetzke commented May 14, 2024

Description

Spike to investigate REST API interceptors/middleware.

Related issues

related to #18446

@github-actions github-actions bot added the component/zeebe Related to the Zeebe component/team label May 14, 2024
koevskinikola and others added 9 commits May 15, 2024 14:37
Attempt to programmatically register Jakarta Filter beans
using the BeanDefinitionRegistryPostProcessor interface.
The BeanDefinitionRegistryPostProcessor bean needs to have a no-args constructor.
It can inject the environment by implementing EnvironmentAware as well.
Using the environment, you can read Spring Boot properties.

WARNING: reading the filters does not work if they are defined using the GatewayCfg
instead of using Spring Boot properties, as far as I can see. This might be an issue.
Fail with a custom servlet filter in the chain that throws an exception.

WARNINGs:

* The exception from a filter is currently not handled by the global advice
that returns application/problem+json for errors. Instead, an application/json
response is returned by the REST gateway. The client cannot properly handle this
as an error response, tries to parse it into a TopologyResponse, and fails with that,
swallowing the original exception.
* The test adds filters to the application.properties statically for PoC purposes.
If possible, the test should add them dynamically. Alternatively, the filter registration
needs to read the gateway properties instead of Spring Boot properties as they would contain
dynamically added filters as well.
Failing a filter means writing a failure response and returning instead of throwing an exception.
Allows to configure chain handlers for REST calls, similarly to ClientInterceptors for gRPC.
Chain handlers can wrap and influence the request execution chain, similar to what's possible with gRPC.
Make a request fail with a custom chain handler for a REST call.
@tmetzke tmetzke force-pushed the spike-dedicated-rest-middleware branch from b126dab to d8256ad Compare May 15, 2024 12:38
tmetzke and others added 2 commits May 15, 2024 14:59
Provide a (Spring Web) CompositeFilter bean which implements
the Jakarta Servlet Filter API for the Zeebe Rest API. The
CompositeFilter bean will act as a wrapper for user-implemented
Filters for the Zeebe Rest API.
@github-actions github-actions bot added component/operate Related to the Operate component/team component/tasklist Related to the Tasklist component/team labels May 22, 2024
@tmetzke
Copy link
Member Author

tmetzke commented May 23, 2024

Closing this as the spike itself is done

@tmetzke tmetzke closed this May 23, 2024
@tmetzke tmetzke deleted the spike-dedicated-rest-middleware branch May 23, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/operate Related to the Operate component/team component/tasklist Related to the Tasklist component/team component/zeebe Related to the Zeebe component/team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants