return session.createTextMessage((String)body);
}
if (body instanceof GenericFile || body instanceof File || body instanceof Reader || body instanceof InputStream || body instanceof ByteBuffer) {
BytesMessage result = session.createBytesMessage();
byte[] bytes = context.getTypeConverter().convertTo(byte[].class, body);
result.writeBytes(bytes);
return result;
}
if (body instanceof Serializable) {
return session.createObjectMessage((Serializable)body);
}