Spring Integration

org.springframework.integration.channel
Class NullChannel

java.lang.Object
  extended by org.springframework.integration.channel.NullChannel
All Implemented Interfaces:
PollableChannel, MessageChannel

public class NullChannel
extends Object
implements PollableChannel

A channel implementation that essentially behaves like "/dev/null". All receive() calls will return null, and all send() calls will return true although no action is performed. Note however that the invocations are logged at debug-level.

Author:
Mark Fisher

Constructor Summary
NullChannel()
           
 
Method Summary
 Message<?> receive()
          Receive a message from this channel, blocking indefinitely if necessary.
 Message<?> receive(long timeout)
          Receive a message from this channel, blocking until either a message is available or the specified timeout period elapses.
 boolean send(Message<?> message)
          Send a Message to this channel.
 boolean send(Message<?> message, long timeout)
          Send a message, blocking until either the message is accepted or the specified timeout period elapses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullChannel

public NullChannel()
Method Detail

send

public boolean send(Message<?> message)
Description copied from interface: MessageChannel
Send a Message to this channel. May throw a RuntimeException for non-recoverable errors. Otherwise, if the Message cannot be sent for a non-fatal reason this method will return 'false', and if the Message is sent successfully, it will return 'true'.

Depending on the implementation, this method may block indefinitely. To provide a maximum wait time, use MessageChannel.send(Message, long).

Specified by:
send in interface MessageChannel
Parameters:
message - the Message to send
Returns:
whether the Message has been sent successfully

send

public boolean send(Message<?> message,
                    long timeout)
Description copied from interface: MessageChannel
Send a message, blocking until either the message is accepted or the specified timeout period elapses.

Specified by:
send in interface MessageChannel
Parameters:
message - the Message to send
timeout - the timeout in milliseconds
Returns:
true if the message is sent successfully, false if the specified timeout period elapses or the send is interrupted

receive

public Message<?> receive()
Description copied from interface: PollableChannel
Receive a message from this channel, blocking indefinitely if necessary.

Specified by:
receive in interface PollableChannel
Returns:
the next available Message or null if interrupted

receive

public Message<?> receive(long timeout)
Description copied from interface: PollableChannel
Receive a message from this channel, blocking until either a message is available or the specified timeout period elapses.

Specified by:
receive in interface PollableChannel
Parameters:
timeout - the timeout in milliseconds
Returns:
the next available Message or null if the specified timeout period elapses or the message reception is interrupted

Spring Integration

Copyright © 2010. All Rights Reserved.