renamed MessageHistory's static 'addComponentToHistory' method to 'write'; simpler and more consistent with the new 'read' method
This commit is contained in:
@@ -170,7 +170,7 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport im
|
||||
Assert.notNull(message, "message must not be null");
|
||||
Assert.notNull(message.getPayload(), "message payload must not be null");
|
||||
if (this.shouldTrack) {
|
||||
message = MessageHistory.addComponentToHistory(message, this);
|
||||
message = MessageHistory.write(message, this);
|
||||
}
|
||||
message = this.convertPayloadIfNecessary(message);
|
||||
message = this.interceptors.preSend(message, this);
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class MessageProducerSupport extends AbstractEndpoint implements
|
||||
|
||||
protected void sendMessage(Message<?> message) {
|
||||
if (message != null) {
|
||||
message = MessageHistory.addComponentToHistory(message, this);
|
||||
message = MessageHistory.write(message, this);
|
||||
}
|
||||
this.messagingTemplate.send(this.outputChannel, message);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class SimpleMessagingGateway extends AbstractMessagingGateway implements
|
||||
try {
|
||||
message = this.inboundMapper.toMessage(object);
|
||||
if (this.shouldTrack) {
|
||||
message = MessageHistory.addComponentToHistory(message, this);
|
||||
message = MessageHistory.write(message, this);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -72,7 +72,7 @@ public abstract class AbstractMessageHandler extends IntegrationObjectSupport im
|
||||
}
|
||||
try {
|
||||
if (message != null && this.shouldTrack) {
|
||||
message = MessageHistory.addComponentToHistory(message, this);
|
||||
message = MessageHistory.write(message, this);
|
||||
}
|
||||
this.handleMessageInternal(message);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class MessageHistory implements List<Properties> {
|
||||
message.getHeaders().get(HEADER_NAME, MessageHistory.class) : null;
|
||||
}
|
||||
|
||||
public static <T> Message<T> addComponentToHistory(Message<T> message, NamedComponent component) {
|
||||
public static <T> Message<T> write(Message<T> message, NamedComponent component) {
|
||||
Assert.notNull(message, "Message must not be null");
|
||||
Assert.notNull(component, "Component must not be null");
|
||||
Properties metadata = extractMetadata(component);
|
||||
|
||||
@@ -38,11 +38,11 @@ public class MessageHistoryTests {
|
||||
public void addComponents() {
|
||||
StringMessage original = new StringMessage("foo");
|
||||
assertNull(MessageHistory.read(original));
|
||||
Message<String> result1 = MessageHistory.addComponentToHistory(original, new TestComponent(1));
|
||||
Message<String> result1 = MessageHistory.write(original, new TestComponent(1));
|
||||
MessageHistory history1 = MessageHistory.read(result1);
|
||||
assertNotNull(history1);
|
||||
assertEquals("testComponent-1", history1.toString());
|
||||
Message<String> result2 = MessageHistory.addComponentToHistory(result1, new TestComponent(2));
|
||||
Message<String> result2 = MessageHistory.write(result1, new TestComponent(2));
|
||||
MessageHistory history2 = MessageHistory.read(result2);
|
||||
assertNotNull(history2);
|
||||
assertEquals("testComponent-1,testComponent-2", history2.toString());
|
||||
@@ -50,7 +50,7 @@ public class MessageHistoryTests {
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void verifyImmutability() {
|
||||
Message<?> message = MessageHistory.addComponentToHistory(MessageBuilder.withPayload("test").build(), new TestComponent(1));
|
||||
Message<?> message = MessageHistory.write(MessageBuilder.withPayload("test").build(), new TestComponent(1));
|
||||
MessageHistory history = MessageHistory.read(message);
|
||||
history.add(new Properties());
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class ChannelPublishingJmsMessageListener extends AbstractMessagingGatewa
|
||||
Message<?> requestMessage = (object instanceof Message<?>) ?
|
||||
MessageBuilder.fromMessage((Message<?>) object).copyHeaders(headers).build() :
|
||||
MessageBuilder.withPayload(object).copyHeaders(headers).build();
|
||||
requestMessage = MessageHistory.addComponentToHistory(requestMessage, this);
|
||||
requestMessage = MessageHistory.write(requestMessage, this);
|
||||
if (!this.expectReply) {
|
||||
this.send(requestMessage);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class JmsDestinationPollingSource extends AbstractJmsTemplateBasedAdapter
|
||||
MessageBuilder<Object> builder = (convertedObject instanceof Message)
|
||||
? MessageBuilder.fromMessage((Message<Object>) convertedObject) : MessageBuilder.withPayload(convertedObject);
|
||||
convertedMessage = builder.copyHeadersIfAbsent(mappedHeaders).build();
|
||||
convertedMessage = MessageHistory.addComponentToHistory(convertedMessage, this);
|
||||
convertedMessage = MessageHistory.write(convertedMessage, this);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new MessagingException(e.getMessage(), e);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class JmsSendingMessageHandler extends AbstractJmsTemplateBasedAdapter im
|
||||
if (message == null) {
|
||||
throw new IllegalArgumentException("message must not be null");
|
||||
}
|
||||
final Message<?> messageToSend = MessageHistory.addComponentToHistory(message, this);
|
||||
final Message<?> messageToSend = MessageHistory.write(message, this);
|
||||
this.getJmsTemplate().convertAndSend(messageToSend, new MessagePostProcessor() {
|
||||
public javax.jms.Message postProcessMessage(javax.jms.Message jmsMessage)
|
||||
throws JMSException {
|
||||
|
||||
Reference in New Issue
Block a user