Package org.objectweb.joram.mom.dest
Class AcquisitionTopic
- java.lang.Object
-
- fr.dyade.aaa.agent.Agent
-
- org.objectweb.joram.mom.dest.Destination
-
- org.objectweb.joram.mom.dest.Topic
-
- org.objectweb.joram.mom.dest.AcquisitionTopic
-
- All Implemented Interfaces:
AgentMBean,Encodable,Serializable,AcquisitionMBean,AcquisitionTopicMBean,ClusterDestinationMBean,DestinationMBean,TopicMBean
public class AcquisitionTopic extends Topic implements AcquisitionTopicMBean
TheAcquisitionTopicclass implements the MOM acquisition topic behavior, basically acquiring messages periodically or on client request, using anAcquisitionModule.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private StringACQ_TOPIC_MAX_MSGprivate StringACQ_TOPIC_MIN_MSGprivate StringacquisitionClassNameThe acquisition class name.private AcquisitionModuleacquisitionModuleThe acquisition module.private longacquisitionNotNbprivate static booleanDEBUGprivate longdiff_maxThe threshold of messages send by the handler in the engineprivate longdiff_minprivate StringlastMessageIdStores the id of the last message received to avoid duplicates.private static Loggerloggerprivate longmsgCountThe number of produced messages.private booleanpauseprivate PropertiespropertiesStores the last set of properties defined.private static longserialVersionUIDdefine serialVersionUID for interoperability-
Fields inherited from class org.objectweb.joram.mom.dest.Topic
fatherId, friends, nbMsgsReceiveSinceCreation, selectors, subscribers
-
Fields inherited from class org.objectweb.joram.mom.dest.Destination
clients, dmqId, freeReading, freeWriting, nbMsgsDeliverSinceCreation, nbMsgsSentToDMQSinceCreation, READ, READWRITE, strbuf, strictCounters, task, temporary, WRITE
-
Fields inherited from class fr.dyade.aaa.agent.Agent
agentProfiling, emptyString, fixed, logmon
-
Fields inherited from interface fr.dyade.aaa.common.encoding.Encodable
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
-
-
Constructor Summary
Constructors Constructor Description AcquisitionTopic()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidacquisitionNot(AgentId from, AcquisitionNot not)This method process messages from the acquisition module.voidagentFinalize(boolean lastTime)Finalizes the agent before it is garbaged.private voidclose()StringdumpProperties()longgetAcquiredMsgCount()Returns the number of messages acquired by the acquisition handler.StringgetAcquisitionClassName()Returns the acquisition handler class name.longgetAcquisitionPeriod()Returns the acquisition period.longgetDiffMax()Returns the maximum number of acquired messages waiting to be handled by the destination.longgetDiffMin()Returns the minimum threshold of acquired messages waiting to be handled by the destination for restarting the acquisition handler.longgetExpiration()Returns the expiration value for produced messages.intgetPriority()Returns the priority of produced messages.voidinitialize(boolean firstTime)Initializes the destination.booleanisMessagePersistent()Returns true if the messages produced are persistent.ClientMessagespreProcess(AgentId from, ClientMessages cm)Incoming JMS messages are processed by the acquisition module and a null ClientMessages is always returned to the base implementation.voidreact(AgentId from, Notification not)Distributes the received notifications to the appropriate reactions.voidsetExpiration(long expiration)Sets the expiration value for produced messages.voidsetMessagePersistent(boolean isPersistent)Sets the DeliveryMode value for the produced messages.voidsetPriority(int priority)Sets the priority of produced messages.voidsetProperties(Properties properties, boolean firstTime)Configures anAcquisitionTopicinstance.protected PropertiesstartHandler(Properties prop)Start the handler.protected PropertiesstopHandler(Properties prop)Stop the handler.StringtoString()Returns a string representation of this destination.-
Methods inherited from class org.objectweb.joram.mom.dest.Topic
clusterJoin, clusterJoinAck, createTopicForward, doClientMessages, doDeleteNot, doRightRequest, doUnknownAgent, finalize, forwardMessages, forwardMessages, getClusterElements, getNbMsgsReceiveSinceCreation, getNumberOfSubscribers, getStats, getSubscriberIds, getType, handleAdminRequestNot, processMessages, sendToCluster, subscribeRequest, topicForwardNot, unsubscribeRequest, wakeUpNot
-
Methods inherited from class org.objectweb.joram.mom.dest.Destination
agentInitialize, clientMessages, decode, delete, deleteNot, encode, forward, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQAgentId, getDMQId, getEncodedSize, getJMXStatistics, getNbMsgsDeliverSinceCreation, getNbMsgsSentToDMQSinceCreation, getPeriod, getRight, getRights, getRights, handleDeniedMessage, interceptorsAvailable, isAdministrator, isFreeReading, isFreeWriting, isLocal, isReader, isValidJMXAttribute, isWriter, postProcess, processAdminCommand, processInterceptors, processPause, processSetRight, processStartHandler, processStopHandler, replyToTopic, requestGroupNot, setAdminId, setFreeReading, setFreeWriting, setPeriod, setRight, unknownAgent
-
Methods inherited from class fr.dyade.aaa.agent.Agent
agentSave, delete, delete, deploy, deploy, doAdminSyncNotification, getAgentId, getCommitTime, getEncodableClassId, getId, getLogTopic, getName, getReactNb, getReactTime, hasName, incWorkInProgress, isAgentProfiling, isDeployed, isFixed, isUpdated, load, needToBeCommited, resetCommitTime, resetReactTime, resetTimer, save, sendTo, sendTo, sendTo, setAgentProfiling, setName, setNoSave, setSave
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface fr.dyade.aaa.agent.AgentMBean
getAgentId, getCommitTime, getReactNb, getReactTime, isAgentProfiling, isFixed, resetCommitTime, resetReactTime, resetTimer, setAgentProfiling
-
Methods inherited from interface org.objectweb.joram.mom.dest.ClusterDestinationMBean
getClusterElements
-
Methods inherited from interface org.objectweb.joram.mom.dest.DestinationMBean
delete, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQId, getName, getNbMsgsDeliverSinceCreation, getNbMsgsReceiveSinceCreation, getNbMsgsSentToDMQSinceCreation, getPeriod, getRight, getRights, getType, isFreeReading, isFreeWriting, setFreeReading, setFreeWriting, setPeriod
-
Methods inherited from interface org.objectweb.joram.mom.dest.TopicMBean
getNumberOfSubscribers, getSubscriberIds
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
logger
private static final Logger logger
-
DEBUG
private static final boolean DEBUG
-
acquisitionModule
private transient AcquisitionModule acquisitionModule
The acquisition module.
-
properties
private Properties properties
Stores the last set of properties defined.
-
lastMessageId
private String lastMessageId
Stores the id of the last message received to avoid duplicates.
-
msgCount
private long msgCount
The number of produced messages.
-
diff_max
private long diff_max
The threshold of messages send by the handler in the engine
-
diff_min
private long diff_min
-
ACQ_TOPIC_MAX_MSG
private final String ACQ_TOPIC_MAX_MSG
- See Also:
- Constant Field Values
-
ACQ_TOPIC_MIN_MSG
private final String ACQ_TOPIC_MIN_MSG
- See Also:
- Constant Field Values
-
pause
private boolean pause
-
acquisitionClassName
private String acquisitionClassName
The acquisition class name.
-
acquisitionNotNb
private transient long acquisitionNotNb
-
-
Method Detail
-
dumpProperties
public String dumpProperties()
- Specified by:
dumpPropertiesin interfaceAcquisitionTopicMBean
-
getDiffMax
public final long getDiffMax()
Returns the maximum number of acquired messages waiting to be handled by the destination. When the number of messages waiting to be handled is greater the acquisition handler is temporarily stopped.A value lesser or equal to 0 disables the mechanism.
- Returns:
- the maximum number of acquired messages waiting to be handled by the destination.
-
getDiffMin
public final long getDiffMin()
Returns the minimum threshold of acquired messages waiting to be handled by the destination for restarting the acquisition handler.- Returns:
- the minimum threshold of acquired messages waiting to be handled by the destination.
-
getAcquisitionClassName
public String getAcquisitionClassName()
Description copied from interface:AcquisitionMBeanReturns the acquisition handler class name.- Specified by:
getAcquisitionClassNamein interfaceAcquisitionMBean- Returns:
- the acquisition handler class name.
-
setProperties
public void setProperties(Properties properties, boolean firstTime) throws Exception
Configures anAcquisitionTopicinstance.- Overrides:
setPropertiesin classDestination- Parameters:
properties- The initial set of properties.- Throws:
Exception
-
initialize
public void initialize(boolean firstTime)
Description copied from class:TopicInitializes the destination.- Overrides:
initializein classTopic- Parameters:
firstTime- true when first called by the factory
-
getAcquiredMsgCount
public final long getAcquiredMsgCount()
Returns the number of messages acquired by the acquisition handler. Be careful this counter is reseted at each time the server starts.- Returns:
- the number of messages acquired by the acquisition handler.
-
react
public void react(AgentId from, Notification not) throws Exception
Description copied from class:TopicDistributes the received notifications to the appropriate reactions.
-
agentFinalize
public void agentFinalize(boolean lastTime)
Description copied from class:DestinationFinalizes the agent before it is garbaged.- Overrides:
agentFinalizein classDestination- Parameters:
lastTime- true if the destination is deleted
-
preProcess
public ClientMessages preProcess(AgentId from, ClientMessages cm)
Incoming JMS messages are processed by the acquisition module and a null ClientMessages is always returned to the base implementation.- Overrides:
preProcessin classDestination- Parameters:
from- The sender of the messagecm- The incoming messages.- Returns:
- The incoming messages after processing.
- See Also:
AcquisitionModule.processMessages(ClientMessages),Destination.preProcess(AgentId, ClientMessages)
-
startHandler
protected Properties startHandler(Properties prop) throws Exception
Start the handler.- Parameters:
prop- properties for start if needed- Returns:
- properties for the reply.
- Throws:
Exception
-
stopHandler
protected Properties stopHandler(Properties prop) throws Exception
Stop the handler.- Parameters:
prop- properties for stop if needed- Returns:
- properties for the reply.
- Throws:
Exception
-
acquisitionNot
private void acquisitionNot(AgentId from, AcquisitionNot not)
This method process messages from the acquisition module. The method addClientMessages of base implementation is used to handle incoming messages.- Parameters:
not-
-
toString
public String toString()
Description copied from class:TopicReturns a string representation of this destination.- Specified by:
toStringin interfaceAgentMBean- Specified by:
toStringin interfaceDestinationMBean- Overrides:
toStringin classTopic- Returns:
- A string representation of this agent.
-
getExpiration
public long getExpiration()
Description copied from interface:AcquisitionMBeanReturns the expiration value for produced messages.- Specified by:
getExpirationin interfaceAcquisitionMBean- Returns:
- the expiration value for produced messages.
-
getPriority
public int getPriority()
Description copied from interface:AcquisitionMBeanReturns the priority of produced messages.- Specified by:
getPriorityin interfaceAcquisitionMBean- Returns:
- the priority of produced messages.
-
isMessagePersistent
public boolean isMessagePersistent()
Description copied from interface:AcquisitionMBeanReturns true if the messages produced are persistent.- Specified by:
isMessagePersistentin interfaceAcquisitionMBean- Returns:
- true if the messages produced are persistent.
-
setExpiration
public void setExpiration(long expiration)
Description copied from interface:AcquisitionMBeanSets the expiration value for produced messages.- Specified by:
setExpirationin interfaceAcquisitionMBean- Parameters:
expiration- the expiration to set.
-
setMessagePersistent
public void setMessagePersistent(boolean isPersistent)
Description copied from interface:AcquisitionMBeanSets the DeliveryMode value for the produced messages. If the parameter is true the messages produced are persistent.- Specified by:
setMessagePersistentin interfaceAcquisitionMBean- Parameters:
isPersistent- if true the messages produced are persistent.
-
setPriority
public void setPriority(int priority)
Description copied from interface:AcquisitionMBeanSets the priority of produced messages.- Specified by:
setPriorityin interfaceAcquisitionMBean- Parameters:
priority- the priority to set.
-
close
private void close()
-
getAcquisitionPeriod
public long getAcquisitionPeriod()
Description copied from interface:AcquisitionMBeanReturns the acquisition period.- Specified by:
getAcquisitionPeriodin interfaceAcquisitionMBean- Returns:
- the acquisition period.
-
-