SonicMQ API

com.sonicsw.stream
Class SonicStreamFactory

java.lang.Object
  extended by com.sonicsw.stream.SonicStreamFactory

public class SonicStreamFactory
extends java.lang.Object

Instantiates Stream Controllers for input and output streams. Also provides accessor methods to set/get properties for controllers.


Field Summary
static java.lang.String APPLICATION_NAME_PROPERTY
          Property name used to define application name which will be included as header property of stream messages
static java.lang.String DEBUG_FLAGS_PROPERTY
          Property name used to define debug flags.
static java.lang.String DELIVERY_MODE_PROPERTY
          Property name used to define DeliveryMode of stream messages and notification messages.
static int DELIVERY_MODE_PROPERTY_DEFAULT
          Default DeliveryMode to be used for stream messages and notification messages.
static java.lang.String READAHEAD_WINDOW_SIZE_PROPERTY
          Property name used to specify "read ahead" window of stream controllers.
static int READAHEAD_WINDOW_SIZE_PROPERTY_DEFAULT
          Default "read ahead" window size (in KB).
static java.lang.String SEGMENT_SIZE_PROPERTY
          Property name used to specify size of segments used to transfer stream data.
static int SEGMENT_SIZE_PROPERTY_DEFAULT
          Default segment size value.
static java.lang.String SEGMENT_TIMEOUT_PROPERTY
          Property name used to specify value of time period that stream controller instances will wait for a given segment of stream data.
static int SEGMENT_TIMEOUT_PROPERTY_DEFAULT
          Default segment timeout value (in seconds).
static java.lang.String STREAM_NOTIFICATION_TOPIC_PROPERTY
          Property name used to define Topic to which stream notification messages will be sent/received
static java.lang.String STREAM_TOPIC_PROPERTY
          Property name used to define Topic to which stream messages will be sent/received.
static java.lang.String USE_TEMP_STREAM_TOPIC_PROPERTY
          Property name used to indicate if Sonic stream controllers created via factory instance will send/receive stream messages to/from a Temporary Topic.
 
Constructor Summary
SonicStreamFactory()
          Construct a ConnectionFactory with default properties.
SonicStreamFactory(java.lang.String streamTopic)
          Construct a ConnectionFactory.
SonicStreamFactory(java.lang.String streamTopic, java.lang.String appName)
          Construct a ConnectionFactory.
 
Method Summary
 SonicInputStreamController createSonicInputStreamController(Connection con)
          Creates an instance of a SonicInputStreamController object.
 SonicInputStreamController createSonicInputStreamController(Connection con, Destination streamDest, Destination notifyDest)
          Creates an instance of a SonicInputStreamController object.
 SonicOutputStreamController createSonicOutputStreamController(Connection con)
          Creates an instance of a SonicOutputStreamController object.
 SonicOutputStreamController createSonicOutputStreamController(Connection con, Destination streamDest, Destination notifyDest)
          Creates an instance of a SonicOutputStreamController object.
 java.lang.String getApplicationName()
          Returns value of APPLICATION_NAME_PROPERTY This name may be set uniquely for the application that makes use of a factory instance, and by default will be included as a property in the header of messages sent by Sonic stream controllers created via the factory instance.
 int getDebugFlags()
          Returns current debug level setting of the factory instance.
 int getDeliveryMode()
          Returns value of DELIVERY_MODE_PROPERTY.
 java.lang.String getNotificationTopic()
          Gets value of STREAM_NOTIFICATION_TOPIC_PROPERTY.
 int getReadaheadWindowSize()
          Gets the size (in KB) of the buffer used for buffering messages that have been received by the streams runtime but not yet read by the application.
 int getSegmentSize()
          Returns the value of SEGMENT_SIZE_PROPERTY.
 int getSegmentTimeout()
          Gets value of SEGMENT_TIMEOUT_PROPERTY property This timeout value represents the amount of time (in seconds) for which a SonicInputStreamController instance will wait for a segment of the stream to arrive.
 java.lang.String getStreamTopic()
          Returns value of STREAM_TOPIC_PROPERTY.
 void setApplicationName(java.lang.String appName)
          Sets value for APPLICATION_NAME_PROPERTY property.
 void setDebugFlags(int flags)
          Sets debug level for an application.
 void setDeliveryMode(int mode)
          Sets the delivery mode for Sonic stream controller instances created via the factory instance.
 void setNotificationTopic(java.lang.String topic)
          Sets name of topic to which all notification messages will be sent/received by stream controllers created via the factory instance.
 void setReadaheadWindowSize(int kbytes)
          Sets the size (in KB) of the buffer used for buffering messages that have been received by the streams runtime but not yet read by the application.
 void setSegmentSize(int segmentSize)
          Sets the value for SEGMENT_SIZE_PROPERTY.
 void setSegmentTimeout(int secs)
          Sets the segment timeout value.
 void setStreamTopic(java.lang.String topic)
          Sets value for STREAM_TOPIC_PROPERTY.
 void useTempStreamTopic(boolean value)
          Sets factory to use a TemporaryTopic for stream messages.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAM_TOPIC_PROPERTY

public static final java.lang.String STREAM_TOPIC_PROPERTY
Property name used to define Topic to which stream messages will be sent/received.

See Also:
Constant Field Values

USE_TEMP_STREAM_TOPIC_PROPERTY

public static final java.lang.String USE_TEMP_STREAM_TOPIC_PROPERTY
Property name used to indicate if Sonic stream controllers created via factory instance will send/receive stream messages to/from a Temporary Topic.

See Also:
Constant Field Values

APPLICATION_NAME_PROPERTY

public static final java.lang.String APPLICATION_NAME_PROPERTY
Property name used to define application name which will be included as header property of stream messages

See Also:
Constant Field Values

SEGMENT_SIZE_PROPERTY

public static final java.lang.String SEGMENT_SIZE_PROPERTY
Property name used to specify size of segments used to transfer stream data.

See Also:
Constant Field Values

SEGMENT_SIZE_PROPERTY_DEFAULT

public static final int SEGMENT_SIZE_PROPERTY_DEFAULT
Default segment size value.

See Also:
Constant Field Values

STREAM_NOTIFICATION_TOPIC_PROPERTY

public static final java.lang.String STREAM_NOTIFICATION_TOPIC_PROPERTY
Property name used to define Topic to which stream notification messages will be sent/received

See Also:
Constant Field Values

SEGMENT_TIMEOUT_PROPERTY

public static final java.lang.String SEGMENT_TIMEOUT_PROPERTY
Property name used to specify value of time period that stream controller instances will wait for a given segment of stream data.

See Also:
Constant Field Values

SEGMENT_TIMEOUT_PROPERTY_DEFAULT

public static final int SEGMENT_TIMEOUT_PROPERTY_DEFAULT
Default segment timeout value (in seconds).

See Also:
Constant Field Values

DELIVERY_MODE_PROPERTY

public static final java.lang.String DELIVERY_MODE_PROPERTY
Property name used to define DeliveryMode of stream messages and notification messages.

See Also:
Constant Field Values

DELIVERY_MODE_PROPERTY_DEFAULT

public static final int DELIVERY_MODE_PROPERTY_DEFAULT
Default DeliveryMode to be used for stream messages and notification messages.

See Also:
Constant Field Values

READAHEAD_WINDOW_SIZE_PROPERTY

public static final java.lang.String READAHEAD_WINDOW_SIZE_PROPERTY
Property name used to specify "read ahead" window of stream controllers.

See Also:
Constant Field Values

READAHEAD_WINDOW_SIZE_PROPERTY_DEFAULT

public static final int READAHEAD_WINDOW_SIZE_PROPERTY_DEFAULT
Default "read ahead" window size (in KB).

See Also:
Constant Field Values

DEBUG_FLAGS_PROPERTY

public static final java.lang.String DEBUG_FLAGS_PROPERTY
Property name used to define debug flags.

See Also:
Constant Field Values
Constructor Detail

SonicStreamFactory

public SonicStreamFactory()
Construct a ConnectionFactory with default properties.


SonicStreamFactory

public SonicStreamFactory(java.lang.String streamTopic,
                          java.lang.String appName)
Construct a ConnectionFactory.

Parameters:
streamTopic - topic name
appName - application name

SonicStreamFactory

public SonicStreamFactory(java.lang.String streamTopic)
Construct a ConnectionFactory.

Parameters:
streamTopic - topic name
Method Detail

setNotificationTopic

public void setNotificationTopic(java.lang.String topic)
Sets name of topic to which all notification messages will be sent/received by stream controllers created via the factory instance.

The notification topic can be overridden by application code by having the application code set the JMSReplyTo property on the notification message.

The default is the temp topic specific to this instance of the application

Parameters:
topic - topic name to be used by all stream controllers created via this factory instance
See Also:
getNotificationTopic(), SonicInputStreamController.buildSenderNotification(int, SonicStream, SonicStreamException), SonicInputStreamController.buildSenderNotification(int, SonicStreamException)

getNotificationTopic

public java.lang.String getNotificationTopic()
Gets value of STREAM_NOTIFICATION_TOPIC_PROPERTY.

This is the Topic to which notification messages are published and from which notification messages are received.

Returns:
name of Topic to which notifications are sent
See Also:
setNotificationTopic(String)

setStreamTopic

public void setStreamTopic(java.lang.String topic)
Sets value for STREAM_TOPIC_PROPERTY.

This is the Topic to which stream messages are published and from which notification messages are received.

Parameters:
topic - name of Topic to which stream messages are published
See Also:
getStreamTopic()

getStreamTopic

public java.lang.String getStreamTopic()
Returns value of STREAM_TOPIC_PROPERTY.

This is the name of the Topic to which stream messages are published.

Returns:
name of Topic to which stream messages are published
See Also:
setStreamTopic(String)

useTempStreamTopic

public void useTempStreamTopic(boolean value)
Sets factory to use a TemporaryTopic for stream messages.

If set, a unique TemporaryTopic will be used to send/receive stream messages by Sonic stream controller instances created via the factory instance.

Parameters:
value - true if factory is to be set to use TemporaryTopics for streams

setApplicationName

public void setApplicationName(java.lang.String appName)
Sets value for APPLICATION_NAME_PROPERTY property.

This name may be set uniquely for the application that makes use of a factory instance, and by default will be included as a property in the header of messages sent by Sonic stream controllers created via the factory instance. The default is "StreamsApp".

Parameters:
appName - application name to be associated with factory instance and objects (e.g. stream controllers) created via factory instance
See Also:
getApplicationName()

getApplicationName

public java.lang.String getApplicationName()
Returns value of APPLICATION_NAME_PROPERTY

This name may be set uniquely for the application that makes use of a factory instance, and by default will be included as a property in the header of messages sent by Sonic stream controllers created via the factory instance.

Returns:
String application name associated with factory instance
See Also:
setApplicationName(String)

setDebugFlags

public void setDebugFlags(int flags)
Sets debug level for an application.

Allowable values for this method are 1 or 2; the value will be 0 if not explicitly specified. The meanings of the values are: 1 high level info 2 detail info (includes high level info)

Parameters:
flags - value of debug level
See Also:
getDebugFlags()

getDebugFlags

public int getDebugFlags()
Returns current debug level setting of the factory instance.

It returns 0 if the debug level hasn't been explicitly set.

Returns:
int debug level value
See Also:
setDebugFlags(int)

setSegmentTimeout

public void setSegmentTimeout(int secs)
Sets the segment timeout value.

This timeout value represents the amount of time (in seconds) for which a SonicInputStreamController instance will wait for a segment of the stream to arrive. The default is 60 seconds.

Parameters:
secs - segment timeout value
See Also:
getSegmentTimeout()

getSegmentTimeout

public int getSegmentTimeout()
Gets value of SEGMENT_TIMEOUT_PROPERTY property

This timeout value represents the amount of time (in seconds) for which a SonicInputStreamController instance will wait for a segment of the stream to arrive.

Returns:
int segment timeout value
See Also:
setSegmentTimeout(int)

setSegmentSize

public void setSegmentSize(int segmentSize)
Sets the value for SEGMENT_SIZE_PROPERTY.

This value defines the size (in bytes) of each segment to be sent by a SonicOutputStreamController for a given stream. The defailt is 16384.

Note: Method applicable to output streams (senders).

Parameters:
segmentSize - segment size
See Also:
getSegmentSize()

getSegmentSize

public int getSegmentSize()
Returns the value of SEGMENT_SIZE_PROPERTY.

This value defines the size (in bytes) of each segment to be sent by a SonicOutputStreamController for a given stream.

Note: Method applicable to output streams (senders).

Returns:
int segment size
See Also:
setSegmentSize(int)

setReadaheadWindowSize

public void setReadaheadWindowSize(int kbytes)
Sets the size (in KB) of the buffer used for buffering messages that have been received by the streams runtime but not yet read by the application.

The readahead window size limit helps to prevent excessive memory consumption by the Sonic stream controller.

The default is 500 (KB).

Note: Method applicable to receivers.

Parameters:
kbytes - unread message buffer size
See Also:
getReadaheadWindowSize()

getReadaheadWindowSize

public int getReadaheadWindowSize()
Gets the size (in KB) of the buffer used for buffering messages that have been received by the streams runtime but not yet read by the application.

The readahead window size limit helps to prevent excessive memory consumption by the Sonic stream controller.

Note: Method applicable to input streams (receivers).

Returns:
int size of "readahead window"
See Also:
setReadaheadWindowSize(int)

setDeliveryMode

public void setDeliveryMode(int mode)
Sets the delivery mode for Sonic stream controller instances created via the factory instance.

For Senders: delivery mode for stream segments For Receivers: delivery mode for sender notifications

Allowed values: javax.jms.DeliveryMode.NON_PERSISTENT (default) or progress.message.jclient.DeliveryMode.NON_PERSISTENT_SYNC

Note: Methods applicable to output streams (senders) and input streams (receivers).

Parameters:
mode - delivery mode used for stream/notification messages
See Also:
getDeliveryMode()

getDeliveryMode

public int getDeliveryMode()
Returns value of DELIVERY_MODE_PROPERTY.

Gets the delivery mode for Sonic stream controller instances created via the factory instance.

For Senders: delivery mode for stream segments For Receivers: delivery mode for sender notifications

Returns:
int delivery mode
See Also:
setDeliveryMode(int)

createSonicOutputStreamController

public SonicOutputStreamController createSonicOutputStreamController(Connection con)
                                                              throws SonicStreamException
Creates an instance of a SonicOutputStreamController object.

This stream controller object is used to create instances of SonicStream objects, and to send data via those stream instances. The stream controller object is also used to receive notification messages from consumers of SonicStream objects.

Parameters:
con - reference to JMS Connection object to be used by stream controller
Returns:
reference to instance of SonicOutputStreamController object
Throws:
SonicStreamException

createSonicOutputStreamController

public SonicOutputStreamController createSonicOutputStreamController(Connection con,
                                                                     Destination streamDest,
                                                                     Destination notifyDest)
                                                              throws SonicStreamException
Creates an instance of a SonicOutputStreamController object.

This stream controller object is used to create instances of SonicStream objects, and to send data via those stream instances. The stream controller object is also used to receive notification messages from consumers of SonicStream objects.

Specifying a non-null Destination object for the stream destination or the notify destination overrides the streamTopic or notificationTopic factory parameters.

Parameters:
con - reference to JMS Connection object to be used by stream controller
streamDest - reference to JMS Destination to which stream messages will be sent
notifyDest - reference to JMS Destination from which notification message will be received
Returns:
reference to instance of SonicOutputStreamController object
Throws:
SonicStreamException

createSonicInputStreamController

public SonicInputStreamController createSonicInputStreamController(Connection con)
                                                            throws SonicStreamException
Creates an instance of a SonicInputStreamController object.

This stream controller object is used to create instances of SonicStream objects, and to receive data via those stream instances. The stream controller object is also used to send notification messages from consumersof SonicStream objects back to the sender.

Parameters:
con - reference to JMS Connection object to be used by stream controller
Returns:
reference to instance of SonicOutputStreamController object
Throws:
SonicStreamException

createSonicInputStreamController

public SonicInputStreamController createSonicInputStreamController(Connection con,
                                                                   Destination streamDest,
                                                                   Destination notifyDest)
                                                            throws SonicStreamException
Creates an instance of a SonicInputStreamController object.

This stream controller object is used to create instances of SonicStream objects, and to receive data via those stream instances. The stream controller object is also used to send notification messages from consumers of SonicStream objects back to the sender.

Specifying a non-null Destination object for the stream destination or the notify destination overrides the streamTopic or notificationTopic factory parameters.

Parameters:
con - reference to JMS Connection object to be used by stream controller
streamDest - reference to JMS Destination from which stream messages will be received.
notifyDest - reference to JMS Destination to which notification message will be sent
Returns:
reference to instance of SonicOutputStreamController object
Throws:
SonicStreamException

SonicMQ API

Copyright © 1999-2011 Progress Software Corporation. All Rights Reserved.
HTML formatted on 5-August-2011.