title: Spring Integration Java DSL - Reusable object in the flow
body: <p>I am new to Spring Integration DSL, and I am stuck with with a problem. I need to use Object from beginning of the flow on a specific point in the subFlow or any other point in the flow, something like a Session variable which is reusable throughout the whole flow. Here is the example where I transform udp request, transform it to http request which is sent to an api function and the received response doesn't contain data needed to make udp response. So somehow I need the data which is in the udp request to make udp response. I have been thinking about the splitter but I don't think that is a solution or even extending the current Integratin flow to my needs. I know the system isn't loosely coupled, but it has to be a way to do this. </p>
  
  <pre><code>@Bean
  public IntegrationFlow udpHttpFlow() {
      return IntegrationFlows.from(udpInboundChannel())
              .transform(udpRequestTransformer())
              /* udp request object to use */
              .&lt;UdpRequest, Boolean&gt;route(SessionObject::sessionExists, mapping -&gt; mapping
                      .subFlowMapping(false, sf -&gt; sf
                              .transform(httpRequestTransformer())
                              .handle(httpOutboundGateway())
                              .transform(httpResponseTransformer()))
                              /*use udp object here .handle(...) */
                      .subFlowMapping(true, sf -&gt; sf
                          /* .handle(...) */
              .transform(udpResponseTransformer())
              .handle(udpOutboundChannel())
              .get();
  }
  </code></pre>