title: How to use ReadBodyPredicateFactory to cache payload data
body: <p>I have Spring Boot microservice, and sending large payload using swagger. At the server I get only 15000 chars and reset 2000 chars are not read.</p>
  
  <p>How can I use ReadBodyPredicateFactory to cache the body message text?</p>
  
  <p>I am using springcloudgateway and added filters. In the filter in apply method I am trying to read the payload json using </p>
  
  <pre><code>  DefaultServerRequest serverRequest = new DefaultServerRequest(exchange);
    body = serverRequest.bodyToMono(String.class).toFuture().get();
  </code></pre>
  
  <p>Sometimes it hangs. </p>
  
  <p>I tried with Flux and then i get only half message 
          Flux body = request.getBody();</p>
  
  <pre><code>    body.subscribe(buffer -&gt; {
  
          try {
              System.out.println("byte count:" + 
             buffer.readableByteCount());
              byte[] bytes = new byte[buffer.readableByteCount()];
              buffer.read(bytes);
              DataBufferUtils.release(buffer);
              String bodyString = new String(bytes, StandardCharsets.UTF_8);
              sb.append(bodyString);
          } catch (Exception e) {
              e.printStackTrace();
          }
  </code></pre>