protected final void addStandardHeaders(TcpConnection connection, MessageHeaders messageHeaders) { String connectionId = connection.getConnectionId(); messageHeaders.put(IpHeaders.HOSTNAME, connection.getHostName()); messageHeaders.put(IpHeaders.IP_ADDRESS, connection.getHostAddress()); messageHeaders.put(IpHeaders.REMOTE_PORT, connection.getPort()); messageHeaders.put(IpHeaders.CONNECTION_ID, connectionId); SocketInfo socketInfo = connection.getSocketInfo(); if (socketInfo != null) { messageHeaders.put(IpHeaders.LOCAL_ADDRESS, socketInfo.getLocalAddress()); } if (this.applySequence) { messageHeaders.put(IntegrationMessageHeaderAccessor.CORRELATION_ID, connectionId); messageHeaders.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, connection.incrementAndGetConnectionSequence()); } if (this.addContentTypeHeader) { messageHeaders.put(MessageHeaders.CONTENT_TYPE, this.contentType); } }
@Filter(inputChannel = "input", outputChannel = "output") public boolean filter(MessageHeaders headers) { // headers are immutable, so if this passes without exception, // the MutableMessageBuilderFactory *was* used... try { headers.put("foo", "bar"); return true; } catch (UnsupportedOperationException e) { return false; } }
message.getHeaders().put(HEADER_NAME, history);
public class NotificationMessagingTemplateCustom extends NotificationMessagingTemplate { public NotificationMessagingTemplateCustom(AmazonSNS amazonSns) { super(amazonSns); } @Override public void sendNotification(Object message, String subject) { MessageHeaders headersCustom = new MessageHeadersCustom(); headersCustom.put(TopicMessageChannel.NOTIFICATION_SUBJECT_HEADER, subject); this.convertAndSend(getRequiredDefaultDestination(), message, headersCustom); } }
protected final void addStandardHeaders(TcpConnection connection, MessageHeaders messageHeaders) { String connectionId = connection.getConnectionId(); messageHeaders.put(IpHeaders.HOSTNAME, connection.getHostName()); messageHeaders.put(IpHeaders.IP_ADDRESS, connection.getHostAddress()); messageHeaders.put(IpHeaders.REMOTE_PORT, connection.getPort()); messageHeaders.put(IpHeaders.CONNECTION_ID, connectionId); SocketInfo socketInfo = connection.getSocketInfo(); if (socketInfo != null) { messageHeaders.put(IpHeaders.LOCAL_ADDRESS, socketInfo.getLocalAddress()); } if (this.applySequence) { messageHeaders.put(IntegrationMessageHeaderAccessor.CORRELATION_ID, connectionId); messageHeaders.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, connection.incrementAndGetConnectionSequence()); } if (this.addContentTypeHeader) { messageHeaders.put(MessageHeaders.CONTENT_TYPE, this.contentType); } }
message.getHeaders().put(HEADER_NAME, history);