/** * Build a JMS message to be sent as response based on the given result object. * @param session the JMS Session to operate on * @param result the content of the message, as returned from the listener method * @return the JMS {@code Message} (never {@code null}) * @throws JMSException if thrown by JMS API methods * @see #setMessageConverter */ protected Message buildMessage(Session session, Object result) throws JMSException { Object content = preProcessResponse(result instanceof JmsResponse ? ((JmsResponse<?>) result).getResponse() : result); MessageConverter converter = getMessageConverter(); if (converter != null) { if (content instanceof org.springframework.messaging.Message) { return this.messagingMessageConverter.toMessage(content, session); } else { return converter.toMessage(content, session); } } if (!(content instanceof Message)) { throw new MessageConversionException( "No MessageConverter specified - cannot handle message [" + content + "]"); } return (Message) content; }
/** * Build a JMS message to be sent as response based on the given result object. * @param session the JMS Session to operate on * @param result the content of the message, as returned from the listener method * @return the JMS {@code Message} (never {@code null}) * @throws JMSException if thrown by JMS API methods * @see #setMessageConverter */ protected Message buildMessage(Session session, Object result) throws JMSException { Object content = preProcessResponse(result instanceof JmsResponse ? ((JmsResponse<?>) result).getResponse() : result); MessageConverter converter = getMessageConverter(); if (converter != null) { if (content instanceof org.springframework.messaging.Message) { return this.messagingMessageConverter.toMessage(content, session); } else { return converter.toMessage(content, session); } } if (!(content instanceof Message)) { throw new MessageConversionException( "No MessageConverter specified - cannot handle message [" + content + "]"); } return (Message) content; }
/** * Build a JMS message to be sent as response based on the given result object. * @param session the JMS Session to operate on * @param result the content of the message, as returned from the listener method * @return the JMS {@code Message} (never {@code null}) * @throws JMSException if thrown by JMS API methods * @see #setMessageConverter */ protected Message buildMessage(Session session, Object result) throws JMSException { Object content = preProcessResponse(result instanceof JmsResponse ? ((JmsResponse<?>) result).getResponse() : result); MessageConverter converter = getMessageConverter(); if (converter != null) { if (content instanceof org.springframework.messaging.Message) { return this.messagingMessageConverter.toMessage(content, session); } else { return converter.toMessage(content, session); } } if (!(content instanceof Message)) { throw new MessageConversionException( "No MessageConverter specified - cannot handle message [" + content + "]"); } return (Message) content; }