org.apache.servicemix.nmr.api
Interface Channel

All Known Subinterfaces:
InternalChannel
All Known Implementing Classes:
ChannelImpl, ClientChannel

public interface Channel

Creates a channel to perform invocations through the NMR. Channels are created by the NMR. They are used by Endpoints to communicate with the NMR, but they can also be used by external clients. In such a case, the Channel must be closed using the close() method after use.

Since:
4.0
Version:
$Revision: $
See Also:
NMR.createChannel()

Method Summary
 void close()
          Closes the channel, freeing up any resources (like sockets, threads etc).
 Exchange createExchange(Pattern pattern)
          Creates a new exchange.
 NMR getNMR()
          Access to the bus
 void send(Exchange exchange)
          An asynchronous invocation of the service
 boolean sendSync(Exchange exchange)
          Synchronously send the exchange, blocking until the exchange is returned.
 boolean sendSync(Exchange exchange, long timeout)
          Synchronously send the exchange
 

Method Detail

getNMR

NMR getNMR()
Access to the bus

Returns:
the NMR

createExchange

Exchange createExchange(Pattern pattern)
Creates a new exchange.

Parameters:
pattern - specify the InOnly / InOut / RobustInOnly / RobustInOut
Returns:
a new exchange of the given pattern

send

void send(Exchange exchange)
An asynchronous invocation of the service

Parameters:
exchange - the exchange to send

sendSync

boolean sendSync(Exchange exchange)
Synchronously send the exchange, blocking until the exchange is returned.

Parameters:
exchange - the exchange to send
Returns:
true if the exchange has been processed succesfully

sendSync

boolean sendSync(Exchange exchange,
                 long timeout)
Synchronously send the exchange

Parameters:
exchange - the exchange to send
timeout - time to wait in milliseconds
Returns:
true if the exchange has been processed succesfully

close

void close()
Closes the channel, freeing up any resources (like sockets, threads etc). Channel that are injected onto Endpoints will be closed automatically by the NMR.



Copyright © 2005-2012 FuseSource. All Rights Reserved.