org.huihoo.jfox.ms.jms.base
Class MessageProducerImpl

java.lang.Object
  extended byorg.huihoo.jfox.ms.jms.base.MessageProducerImpl
All Implemented Interfaces:
javax.jms.MessageProducer
Direct Known Subclasses:
QueueSenderImpl, TopicPublisherImpl

public abstract class MessageProducerImpl
extends java.lang.Object
implements javax.jms.MessageProducer

This class implements the JMS message producer. A client uses a MessageProducer object to send messages to a destination. A MessageProducer object is created by passing a Destination object to a message-producer creation method supplied by a session.

Version:
Revision: 1.1 Date: 2003-05-20 21:35:56
Author:
Peter.Cheng

Field Summary
protected  int defaultDeliveryMode
           
protected  int defaultPriority
           
protected  long defaultTimeToLive
           
protected  boolean disableMessageID
           
protected  boolean disableMessageTimestamp
           
 
Constructor Summary
MessageProducerImpl(SessionImpl session)
           
 
Method Summary
 void close()
          Closes the message producer.
 int getDeliveryMode()
          Gets the producer's default delivery mode.
 boolean getDisableMessageID()
          Gets an indication of whether message IDs are disabled.
 boolean getDisableMessageTimestamp()
          Gets an indication of whether message timestamps are disabled.
 int getPriority()
          Gets the producer's default priority.
 long getTimeToLive()
          Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
 boolean isClosed()
          Indicates the status of this message producer.
protected  void sendMessage(javax.jms.Message message)
          Send message to server.
 void setDeliveryMode(int deliveryMode)
          Sets the producer's default delivery mode.
 void setDisableMessageID(boolean value)
          Sets whether message IDs are disabled.
 void setDisableMessageTimestamp(boolean value)
          Sets whether message timestamps are disabled.
 void setPriority(int priority)
          Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
 void setTimeToLive(long TimeToLive)
          Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultTimeToLive

protected long defaultTimeToLive

defaultDeliveryMode

protected int defaultDeliveryMode

defaultPriority

protected int defaultPriority

disableMessageID

protected boolean disableMessageID

disableMessageTimestamp

protected boolean disableMessageTimestamp
Constructor Detail

MessageProducerImpl

public MessageProducerImpl(SessionImpl session)
Method Detail

getDeliveryMode

public int getDeliveryMode()
                    throws javax.jms.JMSException
Gets the producer's default delivery mode.

Specified by:
getDeliveryMode in interface javax.jms.MessageProducer
Returns:
the message delivery mode for this message producer
Throws:
javax.jms.JMSException

setDeliveryMode

public void setDeliveryMode(int deliveryMode)
                     throws javax.jms.JMSException
Sets the producer's default delivery mode.

Delivery mode is set to PERSISTENT by default.

Specified by:
setDeliveryMode in interface javax.jms.MessageProducer
Parameters:
deliveryMode - the message delivery mode for this message producer; legal values are DeliveryMode.NON_PERSISTENT and DeliveryMode.PERSISTENT
Throws:
javax.jms.JMSException

getDisableMessageID

public boolean getDisableMessageID()
                            throws javax.jms.JMSException
Gets an indication of whether message IDs are disabled.

Specified by:
getDisableMessageID in interface javax.jms.MessageProducer
Returns:
an indication of whether message IDs are disabled
Throws:
javax.jms.JMSException

setDisableMessageID

public void setDisableMessageID(boolean value)
                         throws javax.jms.JMSException
Sets whether message IDs are disabled.

Specified by:
setDisableMessageID in interface javax.jms.MessageProducer
Parameters:
value - indicates if message IDs are disabled
Throws:
javax.jms.JMSException

getDisableMessageTimestamp

public boolean getDisableMessageTimestamp()
                                   throws javax.jms.JMSException
Gets an indication of whether message timestamps are disabled.

Specified by:
getDisableMessageTimestamp in interface javax.jms.MessageProducer
Returns:
an indication of whether message timestamps are disabled
Throws:
javax.jms.JMSException

setDisableMessageTimestamp

public void setDisableMessageTimestamp(boolean value)
                                throws javax.jms.JMSException
Sets whether message timestamps are disabled.

Message timestamps are enabled by default.

Specified by:
setDisableMessageTimestamp in interface javax.jms.MessageProducer
Parameters:
value - indicates if message timestamps are disabled
Throws:
javax.jms.JMSException

getPriority

public int getPriority()
                throws javax.jms.JMSException
Gets the producer's default priority.

Specified by:
getPriority in interface javax.jms.MessageProducer
Returns:
the message priority for this message producer
Throws:
javax.jms.JMSException

setPriority

public void setPriority(int priority)
                 throws javax.jms.JMSException
Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.

Time to live is set to zero by default.

Specified by:
setPriority in interface javax.jms.MessageProducer
Parameters:
priority -
Throws:
javax.jms.JMSException

getTimeToLive

public long getTimeToLive()
                   throws javax.jms.JMSException
Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.

Specified by:
getTimeToLive in interface javax.jms.MessageProducer
Returns:
the message time to live in milliseconds; zero is unlimited
Throws:
javax.jms.JMSException

setTimeToLive

public void setTimeToLive(long TimeToLive)
                   throws javax.jms.JMSException
Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.

Time to live is set to zero by default.

Specified by:
setTimeToLive in interface javax.jms.MessageProducer
Parameters:
TimeToLive -
Throws:
javax.jms.JMSException

sendMessage

protected void sendMessage(javax.jms.Message message)
                    throws javax.jms.JMSException
Send message to server.

Parameters:
message -
Throws:
javax.jms.JMSException

close

public void close()
           throws javax.jms.JMSException
Closes the message producer.

Since a provider may allocate some resources on behalf of a MessageProducer outside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

Specified by:
close in interface javax.jms.MessageProducer
Throws:
javax.jms.JMSException

isClosed

public boolean isClosed()
Indicates the status of this message producer.

Returns:
true if the message producer is closed


Copyright © 2002-2003 Open Enterprise Foundation. All Rights Reserved.