eu.semaine.jms.receiver
Class StateReceiver
java.lang.Object
eu.semaine.jms.IOBase
eu.semaine.jms.receiver.Receiver
eu.semaine.jms.receiver.XMLReceiver
eu.semaine.jms.receiver.StateReceiver
public class StateReceiver
- extends XMLReceiver
Constructor Summary |
StateReceiver(java.lang.String topicName,
StateInfo.Type stateInfoType)
Create a receiver that will listen for all messages in the given Topic
on the default JMS server. |
StateReceiver(java.lang.String topicName,
java.lang.String messageSelector,
StateInfo.Type stateInfoType)
Create a receiver that will listen only to the messages in the given Topic
that will pass the given messageSelector,
on the default JMS server. |
StateReceiver(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
StateInfo.Type stateInfoType)
Create a receiver that will listen for all messages in the given Topic
on the given JMS server. |
StateReceiver(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
java.lang.String messageSelector,
StateInfo.Type stateInfoType)
Create a receiver that will listen only to the messages in the given Topic
that will pass the given messageSelector,
on the given JMS server. |
Methods inherited from class eu.semaine.jms.IOBase |
createConnection, getConnection, getConnection, getConnectionStatus, getJMSPassword, getJMSUrl, getJMSUser, getSession, getTopic, getTopicName, isEmbeddedBroker, startConnection, useEmbeddedBroker |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StateReceiver
public StateReceiver(java.lang.String topicName,
StateInfo.Type stateInfoType)
throws JMSException
- Create a receiver that will listen for all messages in the given Topic
on the default JMS server.
The default JMS server is determined as follows:
- jms URL: read from system property
jms.url
, default value tcp://localhost:61616
;
- jms User: read from system property
jms.user
, default value null
;
- jms Password: read from system property
jms.password
, default value null
.
- Parameters:
topic
- the name of the JMS Topic to listen to.stateInfoType
- the type of state info represented by SEMAINEStateMessage objects created by createSEMAINEMessage(Message)
.
This determines the type of StateInfo
object returned by SEMAINEStateMessage.getState()
.
- Throws:
JMSException
StateReceiver
public StateReceiver(java.lang.String topicName,
java.lang.String messageSelector,
StateInfo.Type stateInfoType)
throws JMSException
- Create a receiver that will listen only to the messages in the given Topic
that will pass the given messageSelector,
on the default JMS server.
The default JMS server is determined as follows:
- jms URL: read from system property
jms.url
, default value tcp://localhost:61616
;
- jms User: read from system property
jms.user
, default value null
;
- jms Password: read from system property
jms.password
, default value null
.
- Parameters:
topicName
- the name of the JMS Topic to listen to.messageSelector
- a message selector expression, see e.g. http://java.sun.com/javaee/5/docs/api/javax/jms/Message.html
for the detailed description.stateInfoType
- the type of state info represented by SEMAINEStateMessage objects created by createSEMAINEMessage(Message)
.
This determines the type of StateInfo
object returned by SEMAINEStateMessage.getState()
.
- Throws:
JMSException
StateReceiver
public StateReceiver(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
StateInfo.Type stateInfoType)
throws JMSException
- Create a receiver that will listen for all messages in the given Topic
on the given JMS server.
- Parameters:
jmsUrl
- the url where to contact the JMS serverjmsUser
- the username to use (can be null)jmsPassword
- the password to use (can be null)topic
- the name of the JMS Topic to listen to.stateInfoType
- the type of state info represented by SEMAINEStateMessage objects created by createSEMAINEMessage(Message)
.
This determines the type of StateInfo
object returned by SEMAINEStateMessage.getState()
.
- Throws:
JMSException
StateReceiver
public StateReceiver(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
java.lang.String messageSelector,
StateInfo.Type stateInfoType)
throws JMSException
- Create a receiver that will listen only to the messages in the given Topic
that will pass the given messageSelector,
on the given JMS server.
- Parameters:
jmsUrl
- the url where to contact the JMS serverjmsUser
- the username to use (can be null)jmsPassword
- the password to use (can be null)topicName
- the name of the JMS Topic to listen to.messageSelector
- a message selector expression, see e.g. http://java.sun.com/javaee/5/docs/api/javax/jms/Message.html
for the detailed description.stateInfoType
- the type of state info represented by SEMAINEStateMessage objects created by createSEMAINEMessage(Message)
.
This determines the type of StateInfo
object returned by SEMAINEStateMessage.getState()
.
- Throws:
JMSException
onMessage
public void onMessage(Message m)
- Overrides:
onMessage
in class Receiver
createSEMAINEMessage
protected SEMAINEMessage createSEMAINEMessage(Message m)
throws MessageFormatException
- Description copied from class:
Receiver
- Create a SEMAINE message from the given JMS message.
Subclasses may want to override this in order to
provide subclasses of SEMAINEMessage for their data.
- Overrides:
createSEMAINEMessage
in class XMLReceiver
- Parameters:
m
- the JMS method to convert into a SEMAINE message.
- Throws:
MessageFormatException
- if the message format is problematic
getCurrentBestGuess
public java.lang.String getCurrentBestGuess(java.lang.String infoItem)
- Provide the current best guess for the given info item.
- Parameters:
infoItem
-
- Returns: