The MessageHeader now has a single Object-typed 'returnAddress' property rather than both 'replyChannel' and 'replyChannelName'. This also removes a package cycle between 'message' and 'channel' (part of INT-112).
This commit is contained in:
@@ -171,7 +171,7 @@ public abstract class AbstractMessageChannel implements MessageChannel, BeanName
|
||||
* value indicates that the method should block until either the message is
|
||||
* accepted or the blocking thread is interrupted.
|
||||
*/
|
||||
public abstract boolean doSend(Message message, long timeout);
|
||||
protected abstract boolean doSend(Message message, long timeout);
|
||||
|
||||
/**
|
||||
* Subclasses must implement this method. A non-negative timeout indicates
|
||||
@@ -180,7 +180,7 @@ public abstract class AbstractMessageChannel implements MessageChannel, BeanName
|
||||
* indicates that the method should block until either a message is
|
||||
* available or the blocking thread is interrupted.
|
||||
*/
|
||||
public abstract Message doReceive(long timeout);
|
||||
protected abstract Message doReceive(long timeout);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -243,18 +243,17 @@ public class DefaultMessageEndpoint implements MessageEndpoint, ChannelRegistryA
|
||||
}
|
||||
|
||||
private MessageChannel resolveReplyChannel(MessageHeader originalMessageHeader) {
|
||||
MessageChannel replyChannel = originalMessageHeader.getReplyChannel();
|
||||
if (replyChannel != null) {
|
||||
return replyChannel;
|
||||
Object returnAddress = originalMessageHeader.getReturnAddress();
|
||||
if (returnAddress instanceof MessageChannel) {
|
||||
return (MessageChannel) returnAddress;
|
||||
}
|
||||
if (this.channelRegistry == null) {
|
||||
return null;
|
||||
if (returnAddress instanceof String && this.channelRegistry != null) {
|
||||
String channelName = (String) returnAddress;
|
||||
if (StringUtils.hasText(channelName)) {
|
||||
return this.channelRegistry.lookupChannel(channelName);
|
||||
}
|
||||
}
|
||||
String replyChannelName = originalMessageHeader.getReplyChannelName();
|
||||
if (StringUtils.hasText(replyChannelName)) {
|
||||
return this.channelRegistry.lookupChannel(replyChannelName);
|
||||
}
|
||||
if (this.defaultOutputChannelName != null) {
|
||||
if (this.defaultOutputChannelName != null && this.channelRegistry != null) {
|
||||
return this.channelRegistry.lookupChannel(this.defaultOutputChannelName);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -23,8 +23,6 @@ import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
|
||||
/**
|
||||
* A holder for Message metadata. This includes information that may be used by
|
||||
* the messaging system (such as <i>correlationId</i>) as well as information
|
||||
@@ -36,23 +34,21 @@ import org.springframework.integration.channel.MessageChannel;
|
||||
*/
|
||||
public class MessageHeader {
|
||||
|
||||
private Date timestamp = new Date();
|
||||
private final Date timestamp = new Date();
|
||||
|
||||
private Date expiration;
|
||||
private volatile Date expiration;
|
||||
|
||||
private Object correlationId;
|
||||
private volatile Object correlationId;
|
||||
|
||||
private MessageChannel replyChannel;
|
||||
private volatile Object returnAddress;
|
||||
|
||||
private String replyChannelName;
|
||||
private volatile int sequenceNumber = 1;
|
||||
|
||||
private int sequenceNumber = 1;
|
||||
private volatile int sequenceSize = 1;
|
||||
|
||||
private int sequenceSize = 1;
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
private Properties properties = new Properties();
|
||||
|
||||
private Map<String, Object> attributes = new ConcurrentHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new ConcurrentHashMap<String, Object>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -86,20 +82,12 @@ public class MessageHeader {
|
||||
this.correlationId = correlationId;
|
||||
}
|
||||
|
||||
public MessageChannel getReplyChannel() {
|
||||
return this.replyChannel;
|
||||
public Object getReturnAddress() {
|
||||
return this.returnAddress;
|
||||
}
|
||||
|
||||
public void setReplyChannel(MessageChannel replyChannel) {
|
||||
this.replyChannel = replyChannel;
|
||||
}
|
||||
|
||||
public String getReplyChannelName() {
|
||||
return this.replyChannelName;
|
||||
}
|
||||
|
||||
public void setReplyChannelName(String replyChannelName) {
|
||||
this.replyChannelName = replyChannelName;
|
||||
public void setReturnAddress(Object returnAddress) {
|
||||
this.returnAddress = returnAddress;
|
||||
}
|
||||
|
||||
public int getSequenceNumber() {
|
||||
|
||||
Reference in New Issue
Block a user