/** * Crate a message from the payload object and message properties provided. The message id will be added to the * properties if necessary later. * @param object the payload * @param messageProperties the message properties (headers) * @param genericType the type to convert from - used to populate type headers. * @return a message * @since 2.1 */ protected Message createMessage(Object object, MessageProperties messageProperties, @Nullable Type genericType) { return createMessage(object, messageProperties); }
@Override public final Message toMessage(Object object, @Nullable MessageProperties messagePropertiesArg, @Nullable Type genericType) throws MessageConversionException { MessageProperties messageProperties = messagePropertiesArg; if (messageProperties == null) { messageProperties = new MessageProperties(); } Message message = createMessage(object, messageProperties, genericType); messageProperties = message.getMessageProperties(); if (this.createMessageIds && messageProperties.getMessageId() == null) { messageProperties.setMessageId(UUID.randomUUID().toString()); } return message; }