title: How to merge or aggregate multiple web services at attribute level[Not whole responses]
body: <p>I have tried to merge the two responses which comes from web services by using the apache Camel. In the below code, I have concatenated two responses.</p>
  
  <pre><code>public Exchange aggregate(Exchange exchange1, Exchange exchange2) {
          if (exchange1 == null) {
              return exchange2;
          } else {
              String body1 = exchange1.getIn().getBody(String.class);
              String body2 = exchange2.getIn().getBody(String.class);
              String merged = (body1 == null) ? body2 : body1 + "," + body2;
              exchange1.getIn().setBody(merged);
              return exchange1;
          }
      }
  </code></pre>
  
  <p>Here my intention is to pick few attributes from response1 and pick few attributes from response2 , then finalize the final response with attributes which we have picked from response 1 and 2. The final response will be send back to client.</p>
  
  <p>Thanks In Advance. </p>
  
  <p><strong>Update :</strong> Can we achieve this by using readily available Camel patterns? If not, any ideas or suggestions to write our own algorithm to handle this case.</p>