SonicMQ API

progress.message.jclient
Interface Channel

All Known Subinterfaces:
RecoverableFileChannel

public interface Channel

This interface contains methods that are implementated by all channels.

See Also:
RecoverableFileChannel

Method Summary
 void close()
          Close the channel.
 void completeConnect()
          Complete the connection with the sender.
 void completeTransfer()
          Complete the transfer of the file.
 void continueTransfer()
          Continue the transfer of information between the sending and receiving client.
 java.lang.String getChannelID()
          Get the channelID associated with this channel.
 ChannelStatus getChannelStatus()
          Get the current channel status.
 int getFragmentSize()
          Get the size of the fragments that will be sent on this channel.
 int getRetryCount()
          Get the retry count.
 long getRetryInterval()
          Get retry interval.
 long getTimeout()
          Get the timeout time of the channel.
 int getWindowSize()
          Get the window size for the transfer.
 void setChannelListener(ChannelListener listener)
          Set a channel listener on the channel.
 void setFragmentSize(int size)
          Set the fragment size for the transfer.
 void setRetryCount(int count)
          Set the retry count.
 void setRetryInterval(long milliseconds)
          Set retry interval.
 void setTimeout(long milliseconds)
          Set the timeout time of this channel.
 void setUUID(java.lang.String uuid, int timeToLive)
          Set the duplicate detection universal unique id.
 void setWindowSize(int size)
          Set the window size for the transfer.
 

Method Detail

getChannelID

java.lang.String getChannelID()
Get the channelID associated with this channel.

Every channel has a unique channelID that is assigned to it when established. This channelID is used for internal purposes; however, this channelID is accessible by the user to assist in associating information with a given channelID. ChannelID's are available across failures and are guaranteed to be unique across all the brokers within a Dynamic Routing setup.

The channelID will be null until after the channel has been sent, or until after getChannel() has been called on the receiver.

Returns:
The ChannelID of this channel. null if the channelID has not been determined.

setTimeout

void setTimeout(long milliseconds)
                throws JMSException
Set the timeout time of this channel.

This method will set the amount of time a send() call will wait for a channel to be established before throwing an exception.

Parameters:
milliseconds - The amount of time to wait for a channel to be established before timing out.
Throws:
JMSException - If there is an internal JMS Error
See Also:
QueueSender.send( javax.jms.Message )

getTimeout

long getTimeout()
                throws JMSException
Get the timeout time of the channel.

Returns:
The timeout time.
Throws:
JMSException - If there is an internal JMS error

setRetryCount

void setRetryCount(int count)
                   throws JMSException
Set the retry count.

This method will set the number of times a piece of information will attempt to be sent before timing out.

Parameters:
count - The number of times to retry.
Throws:
JMSException - If there is an internal JMS error.

getRetryCount

int getRetryCount()
                  throws JMSException
Get the retry count.

This method will retrieve the number of times this channel will retry sending a fragment of information.

Returns:
The number of times we will retry
Throws:
JMSException - If there is an internal JMS Error

setRetryInterval

void setRetryInterval(long milliseconds)
                      throws JMSException
Set retry interval.

This will set the amount of time to wait before attempting to retrying to send or receive a piece of information.

Parameters:
milliseconds - The amount of time, in milliseconds, to wait before trying to resend.
Throws:
JMSException - If there is an internal JMS error.

getRetryInterval

long getRetryInterval()
                      throws JMSException
Get retry interval.

This will get the amount of time to wait before attempting to resend a piece of information.

Returns:
The amount of time, in milliseconds, to wait before attempting to resend a piece of information.
Throws:
JMSException - If there is an internal JMS error.

setWindowSize

void setWindowSize(int size)
                   throws JMSException
Set the window size for the transfer.

This method will set the number of fragments the channel will buffer before it will block sending, awaiting an internal acknowledgement from the receiving client.

The "size" parameter must be 3 or greater.

Parameters:
size - The number of fragments to buffer
Throws:
JMSException - If you attempt to set the window size after a channel has been established, or there is an internal JMS Error.

getWindowSize

int getWindowSize()
                  throws JMSException
Get the window size for the transfer.

This method will get the number of fragments the channel will buffer before it will block sending, awaiting an internal acknowledgement from the receiving client.

Throws:
JMSException - If there is an internal JMS Error.

setFragmentSize

void setFragmentSize(int size)
                     throws JMSException
Set the fragment size for the transfer.

This method will set the size for the fragments that will be sent on this channel.

Parameters:
size - The size, in bytes, of the fragments
Throws:
JMSException - If you attempt to set the window size after a channel has been established, or there is an internal JMS Error.

getFragmentSize

int getFragmentSize()
                    throws JMSException
Get the size of the fragments that will be sent on this channel.

This method will get the size of the fragments being sent on this channel.

Throws:
JMSException - If there is an internal JMS Error.

continueTransfer

void continueTransfer()
                      throws JMSException
Continue the transfer of information between the sending and receiving client.

This method is used in two places. It is used on recovery to restart sending information to the other side of the channel transfer. It also can be used in the ChannelListener callback to continue attempting to retransmit or receive fragments after a RETRY_TIMEOUT has occurred.

Throws:
JMSException - If there is an internal JMS Error.

completeConnect

void completeConnect()
                     throws JMSException,
                            IllegalStateException
Complete the connection with the sender.

This method is used by a channel receiver to start transferring information between the sender and receiver.

Throws:
JMSException - If there is an internal JMS Error.
IllegalStateException - If called on the sender.

getChannelStatus

ChannelStatus getChannelStatus()
                               throws JMSException
Get the current channel status.

This method will return a ChannelStatus object that can be queried to determine the current status of the channel.

Returns:
A ChannelStatus object
Throws:
JMSException - If there is an internal JMS Error

setChannelListener

void setChannelListener(ChannelListener listener)
                        throws JMSException
Set a channel listener on the channel.

This method sets a callback that will be called whenever there is a status update or problem with a channel transfer.

Throws:
JMSException - If there is an internal JMS Error.

close

void close()
           throws JMSException,
                  IllegalStateException
Close the channel. This method will close down the channel and stop the channel transfer. Any recovery information will be preserved. This channel can be recovered from a QueueConnection.

Throws:
JMSException - If there is an internal JMS Error
IllegalStateException - If the channel is already closed.

setUUID

void setUUID(java.lang.String uuid,
             int timeToLive)
             throws JMSException
Set the duplicate detection universal unique id.

This method will activate duplicate detection for the channel. If another channel is sent with the same UUID, an exception can occur.

Parameters:
uuid - The universally unique id.
timeToLive - The time to live for this UUID before another channel can take over.
Throws:
JMSException - If there is an internal JMS Error.

completeTransfer

void completeTransfer()
                      throws JMSException,
                             IllegalStateException
Complete the transfer of the file.

This method can only be called from the ChannelListener after a transfer has been completed. Once completeTransfer() has been called, the ChannelListener will not be notified again.

Throws:
JMSException - If there is an internal JMS Error.
IllegalStateException - If called before the channel transfer is complete, or outside the channel listener callback.

SonicMQ API

Copyright © 1999-2012 Progress Software Corporation. All Rights Reserved.
HTML formatted on 13-March-2012.