001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel;
018
019import java.util.Map;
020import java.util.concurrent.ExecutorService;
021import java.util.concurrent.Future;
022import java.util.concurrent.TimeUnit;
023import java.util.concurrent.TimeoutException;
024
025import org.apache.camel.spi.Synchronization;
026
027/**
028 * Template for working with Camel and sending {@link Message} instances in an
029 * {@link Exchange} to an {@link Endpoint}.
030 * <br/>
031 * <p/><b>Important:</b> Read the javadoc of each method carefully to ensure the behavior of the method is understood.
032 * Some methods is for <tt>InOnly</tt>, others for <tt>InOut</tt> MEP. And some methods throws
033 * {@link org.apache.camel.CamelExecutionException} while others stores any thrown exception on the returned
034 * {@link Exchange}.
035 * <br/>
036 * <p/>The {@link ProducerTemplate} is <b>thread safe</b>.
037 * <br/>
038 * <p/>All the methods which sends a message may throw {@link FailedToCreateProducerException} in
039 * case the {@link Producer} could not be created. Or a {@link NoSuchEndpointException} if the endpoint could
040 * not be resolved. There may be other related exceptions being thrown which occurs <i>before</i> the {@link Producer}
041 * has started sending the message.
042 * <br/>
043 * <p/>All the sendBody or requestBody methods will return the content according to this strategy:
044 * <ul>
045 *   <li>throws {@link org.apache.camel.CamelExecutionException} if processing failed <i>during</i> routing
046 *       with the caused exception wrapped</li>
047 *   <li>The <tt>fault.body</tt> if there is a fault message set and its not <tt>null</tt></li>
048 *   <li>Either <tt>IN</tt> or <tt>OUT</tt> body according to the message exchange pattern. If the pattern is
049 *   Out capable then the <tt>OUT</tt> body is returned, otherwise <tt>IN</tt>.
050 * </ul>
051 * <br/>
052 * <p/>Before using the template it must be started.
053 * And when you are done using the template, make sure to {@link #stop()} the template.
054 * <br/>
055 * <p/><b>Important note on usage:</b> See this
056 * <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">FAQ entry</a>
057 * before using.
058 *
059 * @version 
060 */
061public interface ProducerTemplate extends Service {
062
063    /**
064     * Get the {@link CamelContext}
065     *
066     * @return camelContext the Camel context
067     */
068    CamelContext getCamelContext();
069
070    // Configuration methods
071    // -----------------------------------------------------------------------
072
073    /**
074     * Gets the maximum cache size used in the backing cache pools.
075     *
076     * @return the maximum cache size
077     */
078    int getMaximumCacheSize();
079
080    /**
081     * Sets a custom maximum cache size to use in the backing cache pools.
082     *
083     * @param maximumCacheSize the custom maximum cache size
084     */
085    void setMaximumCacheSize(int maximumCacheSize);
086
087    /**
088     * Gets an approximated size of the current cached resources in the backing cache pools.
089     *
090     * @return the size of current cached resources
091     */
092    int getCurrentCacheSize();
093    
094    /**
095     * Get the default endpoint to use if none is specified
096     * 
097     * @return the default endpoint instance
098     */
099    Endpoint getDefaultEndpoint();
100    
101    /**
102     * Sets the default endpoint to use if none is specified
103     * 
104     * @param defaultEndpoint the default endpoint instance
105     */
106    void setDefaultEndpoint(Endpoint defaultEndpoint);
107
108    /**
109     * Sets the default endpoint uri to use if none is specified
110     * 
111     *  @param endpointUri the default endpoint uri
112     */
113    void setDefaultEndpointUri(String endpointUri);
114
115    /**
116     * Sets whether the {@link org.apache.camel.spi.EventNotifier} should be
117     * used by this {@link ProducerTemplate} to send events about the {@link Exchange}
118     * being sent.
119     * <p/>
120     * By default this is enabled.
121     *
122     * @param enabled <tt>true</tt> to enable, <tt>false</tt> to disable.
123     */
124    void setEventNotifierEnabled(boolean enabled);
125
126    /**
127     * Whether the {@link org.apache.camel.spi.EventNotifier} should be
128     * used by this {@link ProducerTemplate} to send events about the {@link Exchange}
129     * being sent.
130     *
131     * @return <tt>true</tt> if enabled, <tt>false</tt> otherwise
132     */
133    boolean isEventNotifierEnabled();
134
135    // Synchronous methods
136    // -----------------------------------------------------------------------
137
138    /**
139     * Sends the exchange to the default endpoint
140     * <br/><br/>
141     * <b>Notice:</b> that if the processing of the exchange failed with an Exception
142     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
143     * {@link org.apache.camel.Exchange#getException()}.
144     *
145     * @param exchange the exchange to send
146     * @return the returned exchange
147     */
148    Exchange send(Exchange exchange);
149
150    /**
151     * Sends an exchange to the default endpoint using a supplied processor
152     * <br/><br/>
153     * <b>Notice:</b> that if the processing of the exchange failed with an Exception
154     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
155     * {@link org.apache.camel.Exchange#getException()}.
156     *
157     * @param processor the transformer used to populate the new exchange
158     * {@link Processor} to populate the exchange
159     * @return the returned exchange
160     */
161    Exchange send(Processor processor);
162
163    /**
164     * Sends the body to the default endpoint
165     * <br/><br/>
166     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
167     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
168     * the caused exception wrapped.
169     *
170     * @param body the payload to send
171     * @throws CamelExecutionException if the processing of the exchange failed
172     */
173    void sendBody(Object body) throws CamelExecutionException;
174
175    /**
176     * Sends the body to the default endpoint with a specified header and header value
177     * <br/><br/>
178     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
179     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
180     * the caused exception wrapped.
181     *
182     * @param body the payload to send
183     * @param header the header name
184     * @param headerValue the header value
185     * @throws CamelExecutionException if the processing of the exchange failed
186     */
187    void sendBodyAndHeader(Object body, String header, Object headerValue) throws CamelExecutionException;
188
189    /**
190     * Sends the body to the default endpoint with a specified property and property value
191     * <br/><br/>
192     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
193     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
194     * the caused exception wrapped.
195     *
196     * @param body          the payload to send
197     * @param property      the property name
198     * @param propertyValue the property value
199     * @throws CamelExecutionException if the processing of the exchange failed
200     */
201    void sendBodyAndProperty(Object body, String property, Object propertyValue) throws CamelExecutionException;
202    
203    /**
204     * Sends the body to the default endpoint with the specified headers and header values
205     * <br/><br/>
206     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
207     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
208     * the caused exception wrapped.
209     *
210     * @param body the payload to send
211     * @param headers      the headers
212     * @throws CamelExecutionException if the processing of the exchange failed
213     */
214    void sendBodyAndHeaders(Object body, Map<String, Object> headers) throws CamelExecutionException;
215
216    // Allow sending to arbitrary endpoints
217    // -----------------------------------------------------------------------
218
219    /**
220     * Sends the exchange to the given endpoint
221     * <br/><br/>
222     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
223     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
224     * {@link org.apache.camel.Exchange#getException()}.
225     *
226     * @param endpointUri the endpoint URI to send the exchange to
227     * @param exchange    the exchange to send
228     * @return the returned exchange
229     * @throws CamelExecutionException if the processing of the exchange failed
230     */
231    Exchange send(String endpointUri, Exchange exchange);
232
233    /**
234     * Sends an exchange to an endpoint using a supplied processor
235     * <br/><br/>
236     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
237     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
238     * {@link org.apache.camel.Exchange#getException()}.
239     *
240     * @param endpointUri the endpoint URI to send the exchange to
241     * @param processor   the transformer used to populate the new exchange
242     * {@link Processor} to populate the exchange
243     * @return the returned exchange
244     * @throws CamelExecutionException if the processing of the exchange failed
245     */
246    Exchange send(String endpointUri, Processor processor);
247
248    /**
249     * Sends an exchange to an endpoint using a supplied processor
250     * <br/><br/>
251     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
252     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
253     * {@link org.apache.camel.Exchange#getException()}.
254     *
255     * @param endpointUri the endpoint URI to send the exchange to
256     * @param pattern     the message {@link ExchangePattern} such as
257     *                    {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
258     * @param processor   the transformer used to populate the new exchange
259     * {@link Processor} to populate the exchange
260     * @return the returned exchange
261     */
262    Exchange send(String endpointUri, ExchangePattern pattern, Processor processor);
263
264    /**
265     * Sends the exchange to the given endpoint
266     * <br/><br/>
267     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
268     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
269     * {@link org.apache.camel.Exchange#getException()}.
270     *
271     * @param endpoint the endpoint to send the exchange to
272     * @param exchange the exchange to send
273     * @return the returned exchange
274     */
275    Exchange send(Endpoint endpoint, Exchange exchange);
276
277    /**
278     * Sends an exchange to an endpoint using a supplied processor
279     * <br/><br/>
280     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
281     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
282     * {@link org.apache.camel.Exchange#getException()}.
283     *
284     * @param endpoint  the endpoint to send the exchange to
285     * @param processor the transformer used to populate the new exchange
286     * {@link Processor} to populate the exchange
287     * @return the returned exchange
288     */
289    Exchange send(Endpoint endpoint, Processor processor);
290
291    /**
292     * Sends an exchange to an endpoint using a supplied processor
293     * <br/><br/>
294     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
295     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
296     * {@link org.apache.camel.Exchange#getException()}.
297     *
298     * @param endpoint  the endpoint to send the exchange to
299     * @param pattern   the message {@link ExchangePattern} such as
300     *                  {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
301     * @param processor the transformer used to populate the new exchange
302     * {@link Processor} to populate the exchange
303     * @return the returned exchange
304     */
305    Exchange send(Endpoint endpoint, ExchangePattern pattern, Processor processor);
306
307    /**
308     * Send the body to an endpoint
309     * <br/><br/>
310     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
311     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
312     * the caused exception wrapped.
313     *
314     * @param endpoint   the endpoint to send the exchange to
315     * @param body       the payload
316     * @throws CamelExecutionException if the processing of the exchange failed
317     */
318    void sendBody(Endpoint endpoint, Object body) throws CamelExecutionException;
319
320    /**
321     * Send the body to an endpoint
322     * <br/><br/>
323     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
324     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
325     * the caused exception wrapped.
326     *
327     * @param endpointUri   the endpoint URI to send the exchange to
328     * @param body          the payload
329     * @throws CamelExecutionException if the processing of the exchange failed
330     */
331    void sendBody(String endpointUri, Object body) throws CamelExecutionException;
332
333    /**
334     * Send the body to an endpoint with the given {@link ExchangePattern}
335     * returning any result output body
336     * <br/><br/>
337     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
338     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
339     * the caused exception wrapped.
340     *
341     * @param endpoint      the endpoint to send the exchange to
342     * @param body          the payload
343     * @param pattern       the message {@link ExchangePattern} such as
344     *   {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
345     * @return the result if {@link ExchangePattern} is OUT capable, otherwise <tt>null</tt>
346     * @throws CamelExecutionException if the processing of the exchange failed
347     */
348    Object sendBody(Endpoint endpoint, ExchangePattern pattern, Object body) throws CamelExecutionException;
349
350    /**
351     * Send the body to an endpoint returning any result output body
352     * <br/><br/>
353     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
354     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
355     * the caused exception wrapped.
356     *
357     * @param endpointUri   the endpoint URI to send the exchange to
358     * @param pattern       the message {@link ExchangePattern} such as
359     *   {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
360     * @param body          the payload
361     * @return the result if {@link ExchangePattern} is OUT capable, otherwise <tt>null</tt>
362     * @throws CamelExecutionException if the processing of the exchange failed
363     */
364    Object sendBody(String endpointUri, ExchangePattern pattern, Object body) throws CamelExecutionException;
365
366    /**
367     * Sends the body to an endpoint with a specified header and header value
368     * <br/><br/>
369     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
370     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
371     * the caused exception wrapped.
372     *
373     * @param endpointUri the endpoint URI to send to
374     * @param body the payload to send
375     * @param header the header name
376     * @param headerValue the header value
377     * @throws CamelExecutionException if the processing of the exchange failed
378     */
379    void sendBodyAndHeader(String endpointUri, Object body, String header, Object headerValue) throws CamelExecutionException;
380
381    /**
382     * Sends the body to an endpoint with a specified header and header value
383     * <br/><br/>
384     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
385     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
386     * the caused exception wrapped.
387     *
388     * @param endpoint the Endpoint to send to
389     * @param body the payload to send
390     * @param header the header name
391     * @param headerValue the header value
392     * @throws CamelExecutionException if the processing of the exchange failed
393     */
394    void sendBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue) throws CamelExecutionException;
395
396    /**
397     * Sends the body to an endpoint with a specified header and header value
398     * <br/><br/>
399     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
400     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
401     * the caused exception wrapped.
402     *
403     * @param endpoint the Endpoint to send to
404     * @param pattern the message {@link ExchangePattern} such as
405     *   {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
406     * @param body the payload to send
407     * @param header the header name
408     * @param headerValue the header value
409     * @return the result if {@link ExchangePattern} is OUT capable, otherwise <tt>null</tt>
410     * @throws CamelExecutionException if the processing of the exchange failed
411     */
412    Object sendBodyAndHeader(Endpoint endpoint, ExchangePattern pattern, Object body,
413                             String header, Object headerValue) throws CamelExecutionException;
414
415    /**
416     * Sends the body to an endpoint with a specified header and header value
417     * <br/><br/>
418     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
419     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
420     * the caused exception wrapped.
421     *
422     * @param endpoint the Endpoint URI to send to
423     * @param pattern the message {@link ExchangePattern} such as
424     *   {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
425     * @param body the payload to send
426     * @param header the header name
427     * @param headerValue the header value
428     * @return the result if {@link ExchangePattern} is OUT capable, otherwise <tt>null</tt>
429     * @throws CamelExecutionException if the processing of the exchange failed
430     */
431    Object sendBodyAndHeader(String endpoint, ExchangePattern pattern, Object body,
432                             String header, Object headerValue) throws CamelExecutionException;
433
434    /**
435     * Sends the body to an endpoint with a specified property and property value
436     * <br/><br/>
437     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
438     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
439     * the caused exception wrapped.
440     *
441     * @param endpointUri the endpoint URI to send to
442     * @param body the payload to send
443     * @param property the property name
444     * @param propertyValue the property value
445     * @throws CamelExecutionException if the processing of the exchange failed
446     */
447    void sendBodyAndProperty(String endpointUri, Object body, String property, Object propertyValue) throws CamelExecutionException;
448
449    /**
450     * Sends the body to an endpoint with a specified property and property value
451     * <br/><br/>
452     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
453     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
454     * the caused exception wrapped.
455     *
456     * @param endpoint the Endpoint to send to
457     * @param body the payload to send
458     * @param property the property name
459     * @param propertyValue the property value
460     * @throws CamelExecutionException if the processing of the exchange failed
461     */
462    void sendBodyAndProperty(Endpoint endpoint, Object body, String property, Object propertyValue) throws CamelExecutionException;
463
464    /**
465     * Sends the body to an endpoint with a specified property and property value
466     * <br/><br/>
467     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
468     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
469     * the caused exception wrapped.
470     *
471     * @param endpoint the Endpoint to send to
472     * @param pattern the message {@link ExchangePattern} such as
473     *   {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
474     * @param body the payload to send
475     * @param property the property name
476     * @param propertyValue the property value
477     * @return the result if {@link ExchangePattern} is OUT capable, otherwise <tt>null</tt>
478     * @throws CamelExecutionException if the processing of the exchange failed
479     */
480    Object sendBodyAndProperty(Endpoint endpoint, ExchangePattern pattern, Object body,
481                               String property, Object propertyValue) throws CamelExecutionException;
482
483    /**
484     * Sends the body to an endpoint with a specified property and property value
485     * <br/><br/>
486     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
487     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
488     * the caused exception wrapped.
489     *
490     * @param endpoint the Endpoint URI to send to
491     * @param pattern the message {@link ExchangePattern} such as
492     *   {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
493     * @param body the payload to send
494     * @param property the property name
495     * @param propertyValue the property value
496     * @return the result if {@link ExchangePattern} is OUT capable, otherwise <tt>null</tt>
497     * @throws CamelExecutionException if the processing of the exchange failed
498     */
499    Object sendBodyAndProperty(String endpoint, ExchangePattern pattern, Object body,
500                               String property, Object propertyValue) throws CamelExecutionException;
501
502    /**
503     * Sends the body to an endpoint with the specified headers and header values
504     * <br/><br/>
505     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
506     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
507     * the caused exception wrapped.
508     *
509     * @param endpointUri the endpoint URI to send to
510     * @param body the payload to send
511     * @param headers headers
512     * @throws CamelExecutionException if the processing of the exchange failed
513     */
514    void sendBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws CamelExecutionException;
515
516    /**
517     * Sends the body to an endpoint with the specified headers and header values
518     * <br/><br/>
519     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
520     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
521     * the caused exception wrapped.
522     *
523     * @param endpoint the endpoint URI to send to
524     * @param body the payload to send
525     * @param headers headers
526     * @throws CamelExecutionException if the processing of the exchange failed
527     */
528    void sendBodyAndHeaders(Endpoint endpoint, Object body, Map<String, Object> headers) throws CamelExecutionException;
529
530    /**
531     * Sends the body to an endpoint with the specified headers and header values
532     * <br/><br/>
533     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
534     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
535     * the caused exception wrapped.
536     *
537     * @param endpointUri the endpoint URI to send to
538     * @param pattern the message {@link ExchangePattern} such as
539     *   {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
540     * @param body the payload to send
541     * @param headers headers
542     * @return the result if {@link ExchangePattern} is OUT capable, otherwise <tt>null</tt>
543     * @throws CamelExecutionException if the processing of the exchange failed
544     */
545    Object sendBodyAndHeaders(String endpointUri, ExchangePattern pattern, Object body,
546                              Map<String, Object> headers) throws CamelExecutionException;
547
548    /**
549     * Sends the body to an endpoint with the specified headers and header values
550     * <br/><br/>
551     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
552     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
553     * the caused exception wrapped.
554     *
555     * @param endpoint the endpoint URI to send to
556     * @param pattern the message {@link ExchangePattern} such as
557     *   {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut}
558     * @param body the payload to send
559     * @param headers headers
560     * @return the result if {@link ExchangePattern} is OUT capable, otherwise <tt>null</tt>
561     * @throws CamelExecutionException if the processing of the exchange failed
562     */
563    Object sendBodyAndHeaders(Endpoint endpoint, ExchangePattern pattern, Object body,
564                              Map<String, Object> headers) throws CamelExecutionException;
565
566
567    // Methods using an InOut ExchangePattern
568    // -----------------------------------------------------------------------
569
570    /**
571     * Sends an exchange to an endpoint using a supplied processor
572     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
573     * <br/><br/>
574     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
575     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
576     * {@link org.apache.camel.Exchange#getException()}.
577     *
578     * @param endpoint  the Endpoint to send to
579     * @param processor the processor which will populate the exchange before sending
580     * @return the result (see class javadoc)
581     */
582    Exchange request(Endpoint endpoint, Processor processor);
583
584    /**
585     * Sends an exchange to an endpoint using a supplied processor
586     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
587     * <br/><br/>
588     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
589     * it is <b>not</b> thrown from this method, but you can access it from the returned exchange using
590     * {@link org.apache.camel.Exchange#getException()}.
591     *
592     * @param endpointUri the endpoint URI to send to
593     * @param processor the processor which will populate the exchange before sending
594     * @return the result (see class javadoc)
595     */
596    Exchange request(String endpointUri, Processor processor);
597
598    /**
599     * Sends the body to the default endpoint and returns the result content
600     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
601     * <br/><br/>
602     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
603     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
604     * the caused exception wrapped.
605     *
606     * @param body the payload to send
607     * @return the result (see class javadoc)
608     * @throws CamelExecutionException if the processing of the exchange failed
609     */
610    Object requestBody(Object body) throws CamelExecutionException;
611
612    /**
613     * Sends the body to the default endpoint and returns the result content
614     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
615     * <br/><br/>
616     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
617     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
618     * the caused exception wrapped.
619     *
620     * @param body the payload to send
621     * @param type the expected response type
622     * @return the result (see class javadoc)
623     * @throws CamelExecutionException if the processing of the exchange failed
624     */
625    <T> T requestBody(Object body, Class<T> type) throws CamelExecutionException;
626
627    /**
628     * Send the body to an endpoint returning any result output body.
629     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
630     * <br/><br/>
631     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
632     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
633     * the caused exception wrapped.
634     *
635     * @param endpoint the Endpoint to send to
636     * @param body     the payload
637     * @return the result (see class javadoc)
638     * @throws CamelExecutionException if the processing of the exchange failed
639     */
640    Object requestBody(Endpoint endpoint, Object body) throws CamelExecutionException;
641
642    /**
643     * Send the body to an endpoint returning any result output body.
644     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
645     * <br/><br/>
646     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
647     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
648     * the caused exception wrapped.
649     *
650     * @param endpoint the Endpoint to send to
651     * @param body     the payload
652     * @param type     the expected response type
653     * @return the result (see class javadoc)
654     * @throws CamelExecutionException if the processing of the exchange failed
655     */
656    <T> T requestBody(Endpoint endpoint, Object body, Class<T> type) throws CamelExecutionException;
657
658    /**
659     * Send the body to an endpoint returning any result output body.
660     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
661     * <br/><br/>
662     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
663     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
664     * the caused exception wrapped.
665     *
666     * @param endpointUri the endpoint URI to send to
667     * @param body        the payload
668     * @return the result (see class javadoc)
669     * @throws CamelExecutionException if the processing of the exchange failed
670     */
671    Object requestBody(String endpointUri, Object body) throws CamelExecutionException;
672
673    /**
674     * Send the body to an endpoint returning any result output body.
675     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
676     * <br/><br/>
677     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
678     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
679     * the caused exception wrapped.
680     *
681     * @param endpointUri the endpoint URI to send to
682     * @param body        the payload
683     * @param type        the expected response type
684     * @return the result (see class javadoc)
685     * @throws CamelExecutionException if the processing of the exchange failed
686     */
687    <T> T requestBody(String endpointUri, Object body, Class<T> type) throws CamelExecutionException;
688
689    /**
690     * Sends the body to the default endpoint and returns the result content
691     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
692     * <br/><br/>
693     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
694     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
695     * the caused exception wrapped.
696     *
697     * @param body        the payload
698     * @param header      the header name
699     * @param headerValue the header value
700     * @return the result (see class javadoc)
701     * @throws CamelExecutionException if the processing of the exchange failed
702     */
703    Object requestBodyAndHeader(Object body, String header, Object headerValue) throws CamelExecutionException;
704
705    /**
706     * Send the body to an endpoint returning any result output body.
707     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
708     * <br/><br/>
709     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
710     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
711     * the caused exception wrapped.
712     *
713     * @param endpoint    the Endpoint to send to
714     * @param body        the payload
715     * @param header      the header name
716     * @param headerValue the header value
717     * @return the result (see class javadoc)
718     * @throws CamelExecutionException if the processing of the exchange failed
719     */
720    Object requestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue) throws CamelExecutionException;
721
722    /**
723     * Send the body to an endpoint returning any result output body.
724     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
725     * <br/><br/>
726     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
727     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
728     * the caused exception wrapped.
729     *
730     * @param endpoint    the Endpoint to send to
731     * @param body        the payload
732     * @param header      the header name
733     * @param headerValue the header value
734     * @param type        the expected response type
735     * @return the result (see class javadoc)
736     * @throws CamelExecutionException if the processing of the exchange failed
737     */
738    <T> T requestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue, Class<T> type) throws CamelExecutionException;
739
740    /**
741     * Send the body to an endpoint returning any result output body.
742     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
743     * <br/><br/>
744     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
745     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
746     * the caused exception wrapped.
747     *
748     * @param endpointUri the endpoint URI to send to
749     * @param body        the payload
750     * @param header      the header name
751     * @param headerValue the header value
752     * @return the result (see class javadoc)
753     * @throws CamelExecutionException if the processing of the exchange failed
754     */
755    Object requestBodyAndHeader(String endpointUri, Object body, String header, Object headerValue) throws CamelExecutionException;
756
757    /**
758     * Send the body to an endpoint returning any result output body.
759     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
760     * <br/><br/>
761     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
762     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
763     * the caused exception wrapped.
764     *
765     * @param endpointUri the endpoint URI to send to
766     * @param body        the payload
767     * @param header      the header name
768     * @param headerValue the header value
769     * @param type        the expected response type
770     * @return the result (see class javadoc)
771     * @throws CamelExecutionException if the processing of the exchange failed
772     */
773    <T> T requestBodyAndHeader(String endpointUri, Object body, String header, Object headerValue, Class<T> type) throws CamelExecutionException;
774
775    /**
776     * Sends the body to an endpoint with the specified headers and header values.
777     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
778     * <br/><br/>
779     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
780     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
781     * the caused exception wrapped.
782     *
783     * @param endpointUri the endpoint URI to send to
784     * @param body the payload to send
785     * @param headers headers
786     * @return the result (see class javadoc)
787     * @throws CamelExecutionException if the processing of the exchange failed
788     */
789    Object requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws CamelExecutionException;
790
791    /**
792     * Sends the body to an endpoint with the specified headers and header values.
793     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
794     * <br/><br/>
795     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
796     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
797     * the caused exception wrapped.
798     *
799     * @param endpointUri the endpoint URI to send to
800     * @param body the payload to send
801     * @param headers headers
802     * @param type the expected response type
803     * @return the result (see class javadoc)
804     * @throws CamelExecutionException if the processing of the exchange failed
805     */
806    <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers, Class<T> type) throws CamelExecutionException;
807
808    /**
809     * Sends the body to an endpoint with the specified headers and header values.
810     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
811     * <br/><br/>
812     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
813     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
814     * the caused exception wrapped.
815     *
816     * @param endpoint the endpoint URI to send to
817     * @param body the payload to send
818     * @param headers headers
819     * @return the result (see class javadoc)
820     * @throws CamelExecutionException if the processing of the exchange failed
821     */
822    Object requestBodyAndHeaders(Endpoint endpoint, Object body, Map<String, Object> headers) throws CamelExecutionException;
823
824    /**
825     * Sends the body to the default endpoint and returns the result content
826     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
827     * <br/><br/>
828     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
829     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
830     * the caused exception wrapped.
831     *
832     * @param body the payload to send
833     * @param headers headers
834     * @return the result (see class javadoc)
835     * @throws CamelExecutionException if the processing of the exchange failed
836     */
837    Object requestBodyAndHeaders(Object body, Map<String, Object> headers) throws CamelExecutionException;
838
839    /**
840     * Sends the body to an endpoint with the specified headers and header values.
841     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
842     * <br/><br/>
843     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
844     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
845     * the caused exception wrapped.
846     *
847     * @param endpoint the endpoint URI to send to
848     * @param body the payload to send
849     * @param headers headers
850     * @param type the expected response type
851     * @return the result (see class javadoc)
852     * @throws CamelExecutionException if the processing of the exchange failed
853     */
854    <T> T requestBodyAndHeaders(Endpoint endpoint, Object body, Map<String, Object> headers, Class<T> type) throws CamelExecutionException;
855
856
857    // Asynchronous methods
858    // -----------------------------------------------------------------------
859
860    /**
861     * Sets a custom executor service to use for async messaging.
862     *
863     * @param executorService  the executor service.
864     */
865    void setExecutorService(ExecutorService executorService);
866
867    /**
868     * Sends an asynchronous exchange to the given endpoint.
869     *
870     * @param endpointUri the endpoint URI to send the exchange to
871     * @param exchange    the exchange to send
872     * @return a handle to be used to get the response in the future
873     */
874    Future<Exchange> asyncSend(String endpointUri, Exchange exchange);
875
876    /**
877     * Sends an asynchronous exchange to the given endpoint.
878     *
879     * @param endpointUri the endpoint URI to send the exchange to
880     * @param processor   the transformer used to populate the new exchange
881     * @return a handle to be used to get the response in the future
882     */
883    Future<Exchange> asyncSend(String endpointUri, Processor processor);
884
885    /**
886     * Sends an asynchronous body to the given endpoint.
887     * Uses an {@link ExchangePattern#InOnly} message exchange pattern.
888     *
889     * @param endpointUri the endpoint URI to send the exchange to
890     * @param body        the body to send
891     * @return a handle to be used to get the response in the future
892     */
893    Future<Object> asyncSendBody(String endpointUri, Object body);
894
895    /**
896     * Sends an asynchronous body to the given endpoint.
897     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
898     *
899     * @param endpointUri the endpoint URI to send the exchange to
900     * @param body        the body to send
901     * @return a handle to be used to get the response in the future
902     */
903    Future<Object> asyncRequestBody(String endpointUri, Object body);
904
905    /**
906     * Sends an asynchronous body to the given endpoint.
907     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
908     *
909     * @param endpointUri the endpoint URI to send the exchange to
910     * @param body        the body to send
911     * @param header      the header name
912     * @param headerValue the header value
913     * @return a handle to be used to get the response in the future
914     */
915    Future<Object> asyncRequestBodyAndHeader(String endpointUri, Object body, String header, Object headerValue);
916
917    /**
918     * Sends an asynchronous body to the given endpoint.
919     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
920     *
921     * @param endpointUri the endpoint URI to send the exchange to
922     * @param body        the body to send
923     * @param headers     headers
924     * @return a handle to be used to get the response in the future
925     */
926    Future<Object> asyncRequestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers);
927
928    /**
929     * Sends an asynchronous body to the given endpoint.
930     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
931     *
932     * @param endpointUri the endpoint URI to send the exchange to
933     * @param body        the body to send
934     * @param type        the expected response type
935     * @return a handle to be used to get the response in the future
936     */
937    <T> Future<T> asyncRequestBody(String endpointUri, Object body, Class<T> type);
938
939    /**
940     * Sends an asynchronous body to the given endpoint.
941     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
942     *
943     * @param endpointUri the endpoint URI to send the exchange to
944     * @param body        the body to send
945     * @param header      the header name
946     * @param headerValue the header value
947     * @param type        the expected response type
948     * @return a handle to be used to get the response in the future
949     */
950    <T> Future<T> asyncRequestBodyAndHeader(String endpointUri, Object body, String header, Object headerValue, Class<T> type);
951
952    /**
953     * Sends an asynchronous body to the given endpoint.
954     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
955     *
956     * @param endpointUri the endpoint URI to send the exchange to
957     * @param body        the body to send
958     * @param headers     headers
959     * @param type        the expected response type
960     * @return a handle to be used to get the response in the future
961     */
962    <T> Future<T> asyncRequestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers, Class<T> type);
963
964    /**
965     * Sends an asynchronous exchange to the given endpoint.
966     *
967     * @param endpoint    the endpoint to send the exchange to
968     * @param exchange    the exchange to send
969     * @return a handle to be used to get the response in the future
970     */
971    Future<Exchange> asyncSend(Endpoint endpoint, Exchange exchange);
972
973    /**
974     * Sends an asynchronous exchange to the given endpoint.
975     *
976     * @param endpoint    the endpoint to send the exchange to
977     * @param processor   the transformer used to populate the new exchange
978     * @return a handle to be used to get the response in the future
979     */
980    Future<Exchange> asyncSend(Endpoint endpoint, Processor processor);
981
982    /**
983     * Sends an asynchronous body to the given endpoint.
984     * Uses an {@link ExchangePattern#InOnly} message exchange pattern.
985     *
986     * @param endpoint    the endpoint to send the exchange to
987     * @param body        the body to send
988     * @return a handle to be used to get the response in the future
989     */
990    Future<Object> asyncSendBody(Endpoint endpoint, Object body);
991
992    /**
993     * Sends an asynchronous body to the given endpoint.
994     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
995     *
996     * @param endpoint    the endpoint to send the exchange to
997     * @param body        the body to send
998     * @return a handle to be used to get the response in the future
999     */
1000    Future<Object> asyncRequestBody(Endpoint endpoint, Object body);
1001
1002    /**
1003     * Sends an asynchronous body to the given endpoint.
1004     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
1005     *
1006     * @param endpoint the endpoint to send the exchange to
1007     * @param body        the body to send
1008     * @param header      the header name
1009     * @param headerValue the header value
1010     * @return a handle to be used to get the response in the future
1011     */
1012    Future<Object> asyncRequestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue);
1013
1014    /**
1015     * Sends an asynchronous body to the given endpoint.
1016     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
1017     *
1018     * @param endpoint    the endpoint to send the exchange to
1019     * @param body        the body to send
1020     * @param headers     headers
1021     * @return a handle to be used to get the response in the future
1022     */
1023    Future<Object> asyncRequestBodyAndHeaders(Endpoint endpoint, Object body, Map<String, Object> headers);
1024
1025    /**
1026     * Sends an asynchronous body to the given endpoint.
1027     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
1028     *
1029     * @param endpoint    the endpoint to send the exchange to
1030     * @param body        the body to send
1031     * @param type        the expected response type
1032     * @return a handle to be used to get the response in the future
1033     */
1034    <T> Future<T> asyncRequestBody(Endpoint endpoint, Object body, Class<T> type);
1035
1036    /**
1037     * Sends an asynchronous body to the given endpoint.
1038     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
1039     *
1040     * @param endpoint    the endpoint to send the exchange to
1041     * @param body        the body to send
1042     * @param header      the header name
1043     * @param headerValue the header value
1044     * @param type        the expected response type
1045     * @return a handle to be used to get the response in the future
1046     */
1047    <T> Future<T> asyncRequestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue, Class<T> type);
1048
1049    /**
1050     * Sends an asynchronous body to the given endpoint.
1051     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
1052     *
1053     * @param endpoint    the endpoint to send the exchange to
1054     * @param body        the body to send
1055     * @param headers     headers
1056     * @param type        the expected response type
1057     * @return a handle to be used to get the response in the future
1058     */
1059    <T> Future<T> asyncRequestBodyAndHeaders(Endpoint endpoint, Object body, Map<String, Object> headers, Class<T> type);
1060
1061    /**
1062     * Gets the response body from the future handle, will wait until the response is ready.
1063     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
1064     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
1065     * the caused exception wrapped.
1066     *
1067     * @param future      the handle to get the response
1068     * @param type        the expected response type
1069     * @return the result (see class javadoc)
1070     * @throws CamelExecutionException if the processing of the exchange failed
1071     */
1072    <T> T extractFutureBody(Future<Object> future, Class<T> type) throws CamelExecutionException;
1073
1074    /**
1075     * Gets the response body from the future handle, will wait at most the given time for the response to be ready.
1076     * <p/><b>Notice:</b> that if the processing of the exchange failed with an Exception
1077     * it is thrown from this method as a {@link org.apache.camel.CamelExecutionException} with
1078     * the caused exception wrapped.
1079     *
1080     * @param future      the handle to get the response
1081     * @param timeout     the maximum time to wait
1082     * @param unit        the time unit of the timeout argument
1083     * @param type        the expected response type
1084     * @return the result (see class javadoc)
1085     * @throws java.util.concurrent.TimeoutException if the wait timed out
1086     * @throws CamelExecutionException if the processing of the exchange failed
1087     */
1088    <T> T extractFutureBody(Future<Object> future, long timeout, TimeUnit unit, Class<T> type) throws TimeoutException, CamelExecutionException;
1089
1090    // Asynchronous methods with callback
1091    // -----------------------------------------------------------------------
1092
1093    /**
1094     * Sends an asynchronous exchange to the given endpoint.
1095     *
1096     * @param endpointUri   the endpoint URI to send the exchange to
1097     * @param exchange      the exchange to send
1098     * @param onCompletion  callback invoked when exchange has been completed
1099     * @return a handle to be used to get the response in the future
1100     */
1101    Future<Exchange> asyncCallback(String endpointUri, Exchange exchange, Synchronization onCompletion);
1102
1103    /**
1104     * Sends an asynchronous exchange to the given endpoint.
1105     *
1106     * @param endpoint      the endpoint to send the exchange to
1107     * @param exchange      the exchange to send
1108     * @param onCompletion  callback invoked when exchange has been completed
1109     * @return a handle to be used to get the response in the future
1110     */
1111    Future<Exchange> asyncCallback(Endpoint endpoint, Exchange exchange, Synchronization onCompletion);
1112
1113    /**
1114     * Sends an asynchronous exchange to the given endpoint using a supplied processor.
1115     *
1116     * @param endpointUri   the endpoint URI to send the exchange to
1117     * @param processor     the transformer used to populate the new exchange
1118     * {@link Processor} to populate the exchange
1119     * @param onCompletion  callback invoked when exchange has been completed
1120     * @return a handle to be used to get the response in the future
1121     */
1122    Future<Exchange> asyncCallback(String endpointUri, Processor processor, Synchronization onCompletion);
1123
1124    /**
1125     * Sends an asynchronous exchange to the given endpoint using a supplied processor.
1126     *
1127     * @param endpoint      the endpoint to send the exchange to
1128     * @param processor     the transformer used to populate the new exchange
1129     * {@link Processor} to populate the exchange
1130     * @param onCompletion  callback invoked when exchange has been completed
1131     * @return a handle to be used to get the response in the future
1132     */
1133    Future<Exchange> asyncCallback(Endpoint endpoint, Processor processor, Synchronization onCompletion);
1134
1135    /**
1136     * Sends an asynchronous body to the given endpoint.
1137     * Uses an {@link ExchangePattern#InOnly} message exchange pattern.
1138     *
1139     * @param endpointUri   the endpoint URI to send the exchange to
1140     * @param body          the body to send
1141     * @param onCompletion  callback invoked when exchange has been completed
1142     * @return a handle to be used to get the response in the future
1143     */
1144    Future<Object> asyncCallbackSendBody(String endpointUri, Object body, Synchronization onCompletion);
1145
1146    /**
1147     * Sends an asynchronous body to the given endpoint.
1148     * Uses an {@link ExchangePattern#InOnly} message exchange pattern.
1149     *
1150     * @param endpoint      the endpoint to send the exchange to
1151     * @param body          the body to send
1152     * @param onCompletion  callback invoked when exchange has been completed
1153     * @return a handle to be used to get the response in the future
1154     */
1155    Future<Object> asyncCallbackSendBody(Endpoint endpoint, Object body, Synchronization onCompletion);
1156
1157    /**
1158     * Sends an asynchronous body to the given endpoint.
1159     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
1160     *
1161     * @param endpointUri   the endpoint URI to send the exchange to
1162     * @param body          the body to send
1163     * @param onCompletion  callback invoked when exchange has been completed
1164     * @return a handle to be used to get the response in the future
1165     */
1166    Future<Object> asyncCallbackRequestBody(String endpointUri, Object body, Synchronization onCompletion);
1167
1168    /**
1169     * Sends an asynchronous body to the given endpoint.
1170     * Uses an {@link ExchangePattern#InOut} message exchange pattern.
1171     *
1172     * @param endpoint      the endpoint to send the exchange to
1173     * @param body          the body to send
1174     * @param onCompletion  callback invoked when exchange has been completed
1175     * @return a handle to be used to get the response in the future
1176     */
1177    Future<Object> asyncCallbackRequestBody(Endpoint endpoint, Object body, Synchronization onCompletion);
1178
1179}