Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The Null Channel is
PollableChannel used primarily for testing purposes.
The sending methods always return true, indicating
the operation is successful, while the receiving methods always get a
null message. Internally, the code does not create
any queues, but returns true on a
send operation or null on a
receive operation immediately. For the complete
picture (and if you are curious like me), see the actual implementation
of the send and receive methods in
the framework:
// This is the framework class implementation
public class NullChannel implements PollableChannel {
// send will always return true
public boolean send(Message<?> message) {
if (logger.isDebugEnabled()) {
logger.debug("message sent to null channel: " + message);
}
return true;
}
// receive will return null always
public Message<?> receive() {
if (logger.isDebugEnabled()) {
logger.debug("receive called on null channel");
}
return null;
}
...
}