/** * Copy the name-value pairs from the provided Map. This operation will * <em>not</em> overwrite any existing values. */ public MessageBuilder<T> copyHeadersIfAbsent(Map<String, Object> headersToCopy) { Set<String> keys = headersToCopy.keySet(); for (String key : keys) { this.setHeaderIfAbsent(key, headersToCopy.get(key)); } return this; }
protected final void sendReply(Message<?> message, MessageChannel defaultReplyChannel) { MessageChannel replyChannel = this.outputChannel; if (replyChannel == null) { replyChannel = this.resolveReplyChannelFromMessage(message); if (replyChannel == null) { replyChannel = defaultReplyChannel; } } if (replyChannel != null) { if (defaultReplyChannel != null && !defaultReplyChannel.equals(replyChannel)) { message = MessageBuilder.fromMessage(message) .setHeaderIfAbsent(MessageHeaders.REPLY_CHANNEL, defaultReplyChannel) .build(); } if (!this.channelTemplate.send(message, replyChannel)) { throw new MessageDeliveryException(message, "failed to send reply Message"); } } else if (logger.isWarnEnabled()) { logger.warn("unable to determine reply target for aggregation result: " + message); } }