/** * Extract the message body from the given Rabbit message. * @param message the Rabbit <code>Message</code> * @return the content of the message, to be passed into the listener method as argument */ protected Object extractMessage(Message message) { MessageConverter converter = getMessageConverter(); if (converter != null) { return converter.fromMessage(message); } return message; }
/** * Extract the message body from the given Rabbit message. * @param message the Rabbit <code>Message</code> * @return the content of the message, to be passed into the listener method as argument */ protected Object extractMessage(Message message) { MessageConverter converter = getMessageConverter(); if (converter != null) { return converter.fromMessage(message); } return message; }
/** * Build a Rabbit message to be sent as response based on the given result object. * @param channel the Rabbit Channel to operate on. * @param result the content of the message, as returned from the listener method. * @param genericType the generic type to populate type headers. * @return the Rabbit <code>Message</code> (never <code>null</code>). * @see #setMessageConverter */ protected Message buildMessage(Channel channel, Object result, Type genericType) { MessageConverter converter = getMessageConverter(); if (converter != null && !(result instanceof Message)) { return converter.toMessage(result, new MessageProperties(), genericType); } else { if (!(result instanceof Message)) { throw new MessageConversionException("No MessageConverter specified - cannot handle message [" + result + "]"); } return (Message) result; } }
/** * Build a Rabbit message to be sent as response based on the given result object. * @param channel the Rabbit Channel to operate on. * @param result the content of the message, as returned from the listener method. * @param genericType the generic type to populate type headers. * @return the Rabbit <code>Message</code> (never <code>null</code>). * @see #setMessageConverter */ protected Message buildMessage(Channel channel, Object result, Type genericType) { MessageConverter converter = getMessageConverter(); if (converter != null && !(result instanceof Message)) { return converter.toMessage(result, new MessageProperties(), genericType); } else { if (!(result instanceof Message)) { throw new MessageConversionException("No MessageConverter specified - cannot handle message [" + result + "]"); } return (Message) result; } }