org.activemq.transport
Interface TransportChannel

All Superinterfaces:
Service
All Known Implementing Classes:
ActiveIOTransportChannel, CompositeTransportChannel, DiscoveryTransportChannel, JabberTransportChannel, MulticastTransportChannel, PeerTransportChannel, ReliableTransportChannel, RemoteTransportChannel, StompTransportChannel, TcpTransportChannel, TransportChannelSupport, UdpTransportChannel, VmTransportChannel

public interface TransportChannel
extends Service

A TransportChannel is used for tranporting packets between nodes e.g. a ActiveMQ JMS Connection and Broker. The TransportChannel supports synchronous and asynchronous send operations as well as sync or async reading of packets. A TransportChannel implementation could use a dedicated thread using blocking IO to read from a socket or could use NIO or poll some file system or database etc. On receipt of a Packet the TransportChannel should invoke the PacketListener

Version:
$Revision: 1.1.1.1 $

Method Summary
 void addTransportStatusEventListener(TransportStatusEventListener listener)
          Add a listener for changes in a channels status
 void asyncSend(Packet packet)
          Asynchronously send a Packet
 ReceiptHolder asyncSendWithReceipt(Packet packet)
          Asynchronously send a Packet with receipt.
 boolean canProcessWireFormatVersion(int version)
          Can this wireformat process packets of this version
 boolean doesSupportMessageCompression()
          Some transports/wireformats will not be able to understand compressed messages
 boolean doesSupportMessageFragmentation()
          some transports/wire formats will implement their own fragementation
 boolean doesSupportWireFormatVersioning()
          Does the transport support wire format version info
 void forceDisconnect()
          Forces an immediate transport-level disconnect which will be asynchronously reported as an exception to the exceptionListener.
 String getClientID()
           
 int getCurrentWireFormatVersion()
           
 BrokerConnector getEmbeddedBrokerConnector()
          Some transports that rely on an embedded broker need to create the connector used by the broker
 long getLastReceiptTimestamp()
          Gets the timestamp of the last received receipt packet.
 WireFormat getWireFormat()
          Get the current wireformat used by this channel
 boolean isCachingEnabled()
           
 boolean isMulticast()
           
 boolean isNoDelay()
          Inform Transport to send messages as quickly as possible - for Tcp - this means disabling Nagles, which on OSX may provide better performance for sync sends
 boolean isPendingStop()
           
 boolean isServerSide()
           
 boolean isTransportConnected()
           
 boolean isUsedInternally()
           
 void removeTransportStatusEventListener(TransportStatusEventListener listener)
          Remove a listener for changes in a channels status
 boolean requiresEmbeddedBroker()
          Some transports rely on an embedded broker (peer based protocols)
 Receipt send(Packet packet)
          synchronously send a Packet
 Receipt send(Packet packet, int timeout)
          Synchrnously send a Packet
 void setCachingEnabled(boolean cachingEnabled)
           
 void setClientID(String clientID)
          Provides a way to specify the client ID that this channel is using
 void setExceptionListener(ExceptionListener listener)
          Set an exception listener to listen for asynchronously generated exceptions
 void setNoDelay(boolean noDelay)
           
 void setPacketListener(PacketListener l)
          Set a listener for Packets
 void setPendingStop(boolean pendingStop)
          Give the TransportChannel a hint it's about to stop
 void setServerSide(boolean serverSide)
          set the server flag
 void setTransportChannelListener(TransportChannelListener listener)
          A listener to be notified when the channel is removed
 void setUsedInternally(boolean usedInternally)
           
 void setWireFormat(WireFormat wireformat)
          set the wire format to be used by this channel
 void start()
          start listeneing for events
 void stop()
          close the channel
 

Method Detail

setPendingStop

void setPendingStop(boolean pendingStop)
Give the TransportChannel a hint it's about to stop

Parameters:
pendingStop -

isPendingStop

boolean isPendingStop()
Returns:
true if the channel is about to stop

stop

void stop()
close the channel

Specified by:
stop in interface Service

start

void start()
           throws JMSException
start listeneing for events

Specified by:
start in interface Service
Throws:
JMSException - if an error occurs

forceDisconnect

void forceDisconnect()
Forces an immediate transport-level disconnect which will be asynchronously reported as an exception to the exceptionListener. If the channel isn't connected, the call will be ignored.


getLastReceiptTimestamp

long getLastReceiptTimestamp()
Gets the timestamp of the last received receipt packet.

Returns:
the timestamp in milliseconds

send

Receipt send(Packet packet)
             throws JMSException
synchronously send a Packet

Parameters:
packet -
Returns:
a Receipt
Throws:
JMSException

send

Receipt send(Packet packet,
             int timeout)
             throws JMSException
Synchrnously send a Packet

Parameters:
packet - packet to send
timeout - amount of time to wait for a receipt
Returns:
the Receipt
Throws:
JMSException

asyncSend

void asyncSend(Packet packet)
               throws JMSException
Asynchronously send a Packet

Parameters:
packet - the packet to send
Throws:
JMSException

asyncSendWithReceipt

ReceiptHolder asyncSendWithReceipt(Packet packet)
                                   throws JMSException
Asynchronously send a Packet with receipt.

Parameters:
packet - the packet to send
Returns:
a ReceiptHolder for the packet
Throws:
JMSException

setPacketListener

void setPacketListener(PacketListener l)
Set a listener for Packets

Parameters:
l -

setExceptionListener

void setExceptionListener(ExceptionListener listener)
Set an exception listener to listen for asynchronously generated exceptions

Parameters:
listener -

isMulticast

boolean isMulticast()
Returns:
true if this transport is multicast based (i.e. broadcasts to multiple nodes)

addTransportStatusEventListener

void addTransportStatusEventListener(TransportStatusEventListener listener)
Add a listener for changes in a channels status

Parameters:
listener -

removeTransportStatusEventListener

void removeTransportStatusEventListener(TransportStatusEventListener listener)
Remove a listener for changes in a channels status

Parameters:
listener -

setClientID

void setClientID(String clientID)
Provides a way to specify the client ID that this channel is using

Parameters:
clientID -

getClientID

String getClientID()
Returns:
the client ID that this channel is being used for

setTransportChannelListener

void setTransportChannelListener(TransportChannelListener listener)
A listener to be notified when the channel is removed

Parameters:
listener -

isServerSide

boolean isServerSide()
Returns:
true if this transport is used by the broker to communicate with a client, or false if this is a client side transport

setServerSide

void setServerSide(boolean serverSide)
set the server flag

Parameters:
serverSide -

canProcessWireFormatVersion

boolean canProcessWireFormatVersion(int version)
Can this wireformat process packets of this version

Parameters:
version - the version number to test
Returns:
true if can accept the version

getCurrentWireFormatVersion

int getCurrentWireFormatVersion()
Returns:
the current version of this wire format

isTransportConnected

boolean isTransportConnected()
Returns:
true if the transport channel is active, this value will be false through reconnecting

requiresEmbeddedBroker

boolean requiresEmbeddedBroker()
Some transports rely on an embedded broker (peer based protocols)

Returns:
true if an embedded broker required

getEmbeddedBrokerConnector

BrokerConnector getEmbeddedBrokerConnector()
                                           throws JMSException
Some transports that rely on an embedded broker need to create the connector used by the broker

Returns:
the BrokerConnector or null if not applicable
Throws:
JMSException

setWireFormat

void setWireFormat(WireFormat wireformat)
set the wire format to be used by this channel

Parameters:
wireformat -

getWireFormat

WireFormat getWireFormat()
Get the current wireformat used by this channel

Returns:
the current wire format, or null if not set

doesSupportWireFormatVersioning

boolean doesSupportWireFormatVersioning()
Does the transport support wire format version info

Returns:
true if it odes

doesSupportMessageFragmentation

boolean doesSupportMessageFragmentation()
some transports/wire formats will implement their own fragementation

Returns:
true unless a transport/wire format supports it's own fragmentation

doesSupportMessageCompression

boolean doesSupportMessageCompression()
Some transports/wireformats will not be able to understand compressed messages

Returns:
true unless a transport/wire format cannot understand compression

isCachingEnabled

boolean isCachingEnabled()
Returns:
Returns the cachingEnabled.

setCachingEnabled

void setCachingEnabled(boolean cachingEnabled)
Parameters:
cachingEnabled - The cachingEnabled to set.

isNoDelay

boolean isNoDelay()
Inform Transport to send messages as quickly as possible - for Tcp - this means disabling Nagles, which on OSX may provide better performance for sync sends

Returns:
Returns the noDelay.

setNoDelay

void setNoDelay(boolean noDelay)
Parameters:
noDelay - The noDelay to set.

isUsedInternally

boolean isUsedInternally()
Returns:
Returns the usedInternally.

setUsedInternally

void setUsedInternally(boolean usedInternally)
Parameters:
usedInternally - The usedInternally to set.


Copyright © 2004-2008 Protique, Ltd.. All Rights Reserved.