// 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");
future.join(10 * 1000L);
if (!future.isWritten()) {
LOG.warn("Cannot write body: " + body + " using session: " + session);
throw new CamelExchangeException("Cannot write body", exchange);
}
}