// the write operation is asynchronous. Use WriteFuture to wait until the session has been written
WriteFuture future = session.write(body);
// must use a timeout (we use 10s) as in some very high performance scenarios a write can cause
// thread hanging forever
LOG.trace("Waiting for write to complete for body: {} using session: {}", body, session);
if (!future.awaitUninterruptibly(10000L)) {
String message = "Cannot write body: " + body + " using session: " + session;
if (future.getException() != null) {
throw new CamelExchangeException(message, exchange, future.getException());
} else {
throw new CamelExchangeException(message, exchange);