spring-integrationspring-webfluxdeclarative

Spring-Integration webflux: equivalent of attribute message-converters for a webflux inbound-endpoint


I'm attempting a migration from int-http:inbound-gateway version MVC to int-webflux:inbound-gateway version webflux. I'm stuck on the equivalent of the attribute message-converters in the MVC version for webflux. I have converters that are invoked in the MVC side for the return body from the inbound-gateway. Is there no body conversion for inbound-gateway in webflux?


Solution

  • The codec-configurer is some level of equivalent:

        <xsd:attribute name="codec-configurer" type="xsd:string">
            <xsd:annotation>
                <xsd:appinfo>
                    <tool:annotation kind="ref">
                        <tool:expected-type type="org.springframework.http.codec.ServerCodecConfigurer"/>
                    </tool:annotation>
                </xsd:appinfo>
                <xsd:documentation>
                    A 'ServerCodecConfigurer' for the request readers and response writers.
                    By default the 'ServerCodecConfigurer#create()' factory is used.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    

    The WebFlux does not use a HttpMessageConverter abstraction, rather it uses an HttpMessageReader and HttpMessageWriter pairs.

    See more in docs: https://docs.spring.io/spring-integration/docs/current/reference/html/webflux.html#webflux-inbound

    You can configure the WebFluxInboundEndpoint with a custom ServerCodecConfigurer, a RequestedContentTypeResolver, and even a ReactiveAdapterRegistry.