如何将反应式拦截器添加到 Spring 引导注释控制器?

How do you add reactive interceptors to Spring Boot annotated controllers?

我在 CLIENT 端使用 rsocket-micrometer 设置了 rsocket 指标,方法是使用拦截器配置 RSocketConnector,如下所示 (Kotlin):

    rSocketReqesterBuilder.rsocketConnector { configureConnector(it) }

   // ...

    private fun configureConnector(rSocketConnector: RSocketConnector) {
        rSocketConnector.interceptors { iRegistry ->
            // This gives us the rsocket.* counter metrics, like rsocket.frame
            iRegistry.forResponder(MicrometerRSocketInterceptor(registry, *localTags.toArray()))
            iRegistry.forRequester(MicrometerRSocketInterceptor(registry, *localTags.toArray()))
            iRegistry.forConnection(MicrometerDuplexConnectionInterceptor(registry, *localTags.toArray()))
        }
    }

但是在 SERVER 端,我正在使用带注释的 (@MessageMapping) Spring 引导 RSocket 控制器,就像这样 (Java):

    @MessageMapping("replace-channel-controller")
    public Flux<TransformResponse> replace(Flux<String> texts) ...

在这里,我没有明确控制连接器。
如何在服务器端添加拦截器?

@Configuration
public class RSocketConfig implements RSocketServerCustomizer {

    private final MeterRegistry registry;

    public RSocketConfig(MeterRegistry registry) {
        this.registry = registry;
    }

    @Override
    public void customize(RSocketServer rSocketServer) {
        rSocketServer.interceptors(
                iRegistry -> {
                    log.info("Adding RSocket interceptors...");
                    iRegistry.forResponder(new MicrometerRSocketInterceptor(registry, tags));
                    iRegistry.forRequester(new MicrometerRSocketInterceptor(registry, tags));
                    iRegistry.forConnection(new MicrometerDuplexConnectionInterceptor(registry, tags));
                }
        );
    }
}