Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3

I using spring Spring boot 2.1.0.

public Mono<ServerResponse> getConvertXmlToJson(ServerRequest serverRequest) {
        Mono<String> requestString = serverRequest.bodyToMono(String.class);
        Mono<String> response = this.convertFormatService.convertXmlToJson(requestString);
        return response.subscribeOn(elastic()).flatMap(rta -> ok()
                .contentType(APPLICATION_JSON_UTF8)
                .body(fromObject(rta)))
                .switchIfEmpty(ServerResponse.badRequest().build());
    }

call this method in other bean

private Mono<String> converter(String function, Mono<String> stringToConverter, String setting) {
    log.info("salida, {}", stringToConverter.block());
    try {
        Object result = invocable.invokeFunction(function, stringToConverter, setting);
        log.info("{}", result);
        return Mono.just((String) result);
    } catch (Exception e) {
        throw new ConverterException(e.getMessage());
    }
}

I need to pass a string value no a Mono, when I pass Mono the answer is empty.

When I try to get a string value from Mono I get this error:

{
    "timestamp": "2018-11-13T03:29:02.161+0000",
    "path": "/v1/convert",
    "status": 500,
    "error": "Internal Server Error",
    "message": "block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3",
    "trace": "java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3\r\n\tat reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:77)\r\n\tat reactor.core.publisher.Mono.block(Mono.java:1475)\r\n\tat lf.co.com.examplespringconverterxmljson.services.impl.ConvertFormatServiceImpl.converter(ConvertFormatServiceImpl.java:58)\r\n\tat lf.co.com.examplespringconverterxmljson.services.impl.ConvertFormatServiceImpl.convertXmlToJson(ConvertFormatServiceImpl.java:49)\r\n\tat lf.co.com.examplespringconverterxmljson.routing.handler.ConvertHandler.getConvertXmlToJson(ConvertHandler.java:25)\r\n\tat org.springframework.web.reactive.function.server.support.HandlerFunctionAdapter.handle(HandlerFunctionAdapter.java:61)\r\n\tat org.springframework.web.reactive.DispatcherHandler.invokeHandler(DispatcherHandler.java:159)\r\n\tat org.springframework.web.reactive.DispatcherHandler.lambda$handle$1(DispatcherHandler.java:151)\r\n\tat reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:67)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.java:275)\r\n\tat reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:849)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:67)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2041)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.java:458)\r\n\tat reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.java:155)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.java:458)\r\n\tat reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:1849)\r\n\tat reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:1723)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.java:442)\r\n\tat reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.java:86)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.java:442)\r\n\tat reactor.core.publisher.MonoJust.subscribe(MonoJust.java:54)\r\n\tat reactor.core.publisher.MonoCallableOnAssembly.subscribe(MonoCallableOnAssembly.java:82)\r\n\tat reactor.core.publisher.MonoMap.subscribe(MonoMap.java:55)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoSwitchIfEmpty.subscribe(MonoSwitchIfEmpty.java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.java:74)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.java:74)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.java:59)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.Mono.subscribe(Mono.java:3590)\r\n\tat reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:442)\r\n\tat reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onSubscribe(FluxConcatMap.java:212)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.java:442)\r\n\tat reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:139)\r\n\tat reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:63)\r\n\tat reactor.core.publisher.FluxOnAssembly.subscribe(FluxOnAssembly.java:164)\r\n\tat reactor.core.publisher.FluxConcatMap.subscribe(FluxConcatMap.java:121)\r\n\tat reactor.core.publisher.FluxOnAssembly.subscribe(FluxOnAssembly.java:164)\r\n\tat reactor.core.publisher.MonoNext.subscribe(MonoNext.java:40)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoSwitchIfEmpty.subscribe(MonoSwitchIfEmpty.java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1476)\r\n\tat reactor.core.publisher.MonoProcessor.onNext(MonoProcessor.java:389)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)\r\n\tat reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2041)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.java:458)\r\n\tat reactor.core.publisher.MonoProcessor.onSubscribe(MonoProcessor.java:399)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.java:442)\r\n\tat reactor.core.publisher.MonoJust.subscribe(MonoJust.java:54)\r\n\tat reactor.core.publisher.MonoCallableOnAssembly.subscribe(MonoCallableOnAssembly.java:82)\r\n\tat reactor.core.publisher.Mono.subscribe(Mono.java:3590)\r\n\tat reactor.core.publisher.MonoProcessor.add(MonoProcessor.java:531)\r\n\tat reactor.core.publisher.MonoProcessor.subscribe(MonoProcessor.java:444)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.java:59)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:71)\r\n\tat reactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.java:61)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.core.publisher.Mono.subscribe(Mono.java:3590)\r\n\tat reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:172)\r\n\tat reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:71)\r\n\tat reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.java:70)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:71)\r\n\tat reactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.java:61)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)\r\n\tat reactor.netty.http.server.HttpServerHandle.onStateChange(HttpServerHandle.java:64)\r\n\tat reactor.netty.tcp.TcpServerBind$ChildObserver.onStateChange(TcpServerBind.java:226)\r\n\tat reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:431)\r\n\tat reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:141)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)\r\n\tat reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:159)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)\r\n\tat io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:297)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:413)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)\r\n\tat io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)\r\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)\r\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)\r\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:628)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:563)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:480)\r\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442)\r\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\n\tSuppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: \nAssembly trace from producer [reactor.core.publisher.MonoFlatMap] :\n\treactor.core.publisher.Mono.flatMap(Mono.java:2454)\n\torg.springframework.web.reactive.DispatcherHandler.handle(DispatcherHandler.java:151)\n\torg.springframework.web.server.handler.DefaultWebFilterChain.lambda$filter$0(DefaultWebFilterChain.java:122)\n\treactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)\n\treactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)\n\treactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)\n\treactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1476)\n\treactor.core.publisher.MonoProcessor.onNext(MonoProcessor.java:389)\n\treactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2041)\n\treactor.core.publisher.MonoProcessor.onSubscribe(MonoProcessor.java:399)\n\treactor.core.publisher.MonoJust.subscribe(MonoJust.java:54)\n\treactor.core.publisher.Mono.subscribe(Mono.java:3590)\n\treactor.core.publisher.MonoProcessor.add(MonoProcessor.java:531)\n\treactor.core.publisher.MonoProcessor.subscribe(MonoProcessor.java:444)\n\treactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.java:59)\n\treactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60)\n\treactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)\n\treactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)\n\treactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)\n\treactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.java:61)\n\treactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)\n\treactor.core.publisher.Mono.subscribe(Mono.java:3590)\n\treactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:172)\n\treactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)\n\treactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.java:70)\n\treactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.java:61)\n\treactor.netty.http.server.HttpServerHandle.onStateChange(HttpServerHandle.java:64)\n\treactor.netty.tcp.TcpServerBind$ChildObserver.onStateChange(TcpServerBind.java:226)\n\treactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:431)\n\treactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:141)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)\n\tio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)\n\treactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:159)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)\n\tio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)\n\tio.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)\n\tio.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)\n\tio.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:297)\n\tio.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:413)\n\tio.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)\n\tio.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)\n\tio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)\n\tio.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)\n\tio.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)\n\tio.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)\n\tio.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:628)\n\tio.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:563)\n\tio.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:480)\n\tio.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442)\n\tio.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)\nError has been observed by the following operator(s):\n\t|_\tMono.flatMap ⇢ org.springframework.web.reactive.DispatcherHandler.handle(DispatcherHandler.java:151)\n\t|_\tMono.flatMap ⇢ org.springframework.web.reactive.DispatcherHandler.handle(DispatcherHandler.java:152)\n\t|_\tMono.defer ⇢ org.springframework.web.server.handler.DefaultWebFilterChain.filter(DefaultWebFilterChain.java:119)\n\t|_\tMono.flatMap ⇢ org.springframework.web.filter.reactive.HiddenHttpMethodFilter.filter(HiddenHttpMethodFilter.java:90)\n\t|_\tMono.defer ⇢ org.springframework.web.server.handler.DefaultWebFilterChain.filter(DefaultWebFilterChain.java:119)\n\r\n"
}

if someone has a solution, I'll appreciate it

like image 685
Lewis Florez R Avatar asked Oct 17 '22 10:10

Lewis Florez R


1 Answers

Maybe, change the converter method (and convertXmlToJson) to take a String instead of Mono<String>

Then you can do something like this:

Mono<String> response = requestString.flatMap(s -> this.convertFormatService.convertXmlToJson(s));

I think there may be some more cleanup in there that can be done, but hopefully this get you closer.

like image 84
Thor Avatar answered Oct 21 '22 00:10

Thor