/** * Converts from a Camel message to a HzMq message. The headers are simply * copied unmodified. The body is mapped by type: * <ul> * <li>If the content type is text/plain, the body is set as a String</li> * <li>all others: the body is set as a byte[] (or null)</li> * </ul> * * @param mqMsg the HzMq message to convert * * @return the new Camel message */ @Override public Message toCamelMessage(HazelcastMQMessage mqMsg) { DefaultMessage camelMsg = new DefaultMessage(); camelMsg.setHeaders((Map) mqMsg.getHeaders().getHeaderMap()); if (mqMsg.getContentType() != null && mqMsg.getContentType().equals( "text/plain")) { camelMsg.setBody(mqMsg.getBodyAsString()); } else { camelMsg.setBody(mqMsg.getBody()); } return camelMsg; } }