eu.semaine.jms.sender
Class StateSender
java.lang.Object
eu.semaine.jms.IOBase
eu.semaine.jms.sender.Sender
eu.semaine.jms.sender.XMLSender
eu.semaine.jms.sender.StateSender
public class StateSender
- extends XMLSender
An abstraction of Sender for state data.
- Author:
- marc
Constructor Summary |
StateSender(java.lang.String topicName,
java.lang.String datatype,
java.lang.String source)
Create a new Sender to the given topic on the default JMS server. |
StateSender(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
java.lang.String datatype,
java.lang.String source)
Create a new Sender to the given topic on the given JMS server. |
Methods inherited from class eu.semaine.jms.sender.Sender |
getDatatype, getPeriod, getSource, getTimeToLive, initialise, isEventBased, isPeriodic, main, sendTextMessage, sendTextMessage, setEventBased, setPeriodic, setTimeToLive |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StateSender
public StateSender(java.lang.String topicName,
java.lang.String datatype,
java.lang.String source)
throws javax.jms.JMSException
- Create a new Sender to 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
.
Datatype and source will be sent with every message.
- Parameters:
topic
- the name of the topic to send to.datatype
- the name of the type of data being sent.source
- the name of the component sending the data.
- Throws:
java.lang.NullPointerException
- if any of the parameters topicName, datatype, or source are null.
javax.jms.JMSException
StateSender
public StateSender(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
java.lang.String datatype,
java.lang.String source)
throws javax.jms.JMSException
- Create a new Sender to the given topic on the given JMS server.
Datatype and source will be sent with every message.
- 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 topic to send to.datatype
- the name of the type of data being sent.source
- the name of the component sending the data.
- Throws:
javax.jms.JMSException
java.lang.NullPointerException
- if any of the parameters jmsUrl, topicName, datatype, or source are null.
sendStateInfo
public void sendStateInfo(StateInfo s,
long usertime)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
fillMessageProperties
protected void fillMessageProperties(javax.jms.Message message,
long usertime)
throws javax.jms.JMSException
- Description copied from class:
Sender
- Fill in the usual message properties as far as possible.
Subclasses are encouraged to override this method, but should
normally call this method as well (as
super.fillMessageProperties(message, usertime)
).
- Overrides:
fillMessageProperties
in class XMLSender
usertime
- the "user" time that this message refers to,
in milliseconds since 1970.
- Throws:
javax.jms.JMSException