apache / apisix-java-plugin-runner

APISIX Plugin Runner in Java
https://apisix.apache.org/
Apache License 2.0
126 stars 95 forks source link

request help: trigger a the postFitler method #308

Closed paologazzola closed 3 weeks ago

paologazzola commented 3 weeks ago

Issue description

Hello, I wrote my first external plugin with this code:

public class ExamplePostFilter implements PluginFilter {

    @Override
    public String name() {
        return "ExamplePostFilter";
    }

    @Override
    public void postFilter(PostRequest request, PostResponse response, PluginFilterChain chain) {
        ... some logic ...
        chain.postFilter(request, response);
    }

}

Then I configured my route in this way:

  ...
  "ext-plugin-post-req": {
      "conf": [
        {
          "name": "ExamplePostFilter",
          "value": "{\n\"variable1\": \"testme\"\n}"
        }
      ]
    }

When I query the route, the postMethod(...) is never triggered (my breakpoints are ignored and no log is written). If I add in my plugin class some overrided methods like requiredRespBody(), I correctly see that they are triggered. I think that for some reasons (or some bad configuration), the doPostFilter(...) in the RpcCallHandles class is never reached.

What am I doing wrong with my plugin configuration?

Thanks a lot. Paolo

Environment

Apisix 3.9.x
apisix-java-plugin-runner 0.5.0

paologazzola commented 3 weeks ago

My fault, i have to use ext-plugin-post-resp instead of ext-plugin-post-req.