Package ejava.examples.jmsscheduler
Class Requestor
- java.lang.Object
-
- ejava.examples.jmsscheduler.Requestor
-
- All Implemented Interfaces:
Runnable
,MessageListener
public class Requestor extends Object implements Runnable, MessageListener
This is used to simulate work being tasked to a scheduling queue. Each request will be tracked for a result.
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionFactory
connFactory
protected int
count
private static org.slf4j.Logger
logger
protected int
maxCount
protected String
name
protected String
password
protected Destination
requestQueue
protected Map<String,Message>
requests
protected int
responseCount
protected long
sleepTime
protected boolean
started
protected long
startTime
protected boolean
stop
protected boolean
stopped
protected String
username
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearMessages()
protected JMSContext
createContext(Integer sessionMode)
void
execute()
int
getCount()
boolean
isStarted()
boolean
isStopped()
static void
main(String[] args)
void
onMessage(Message message)
This method is used to asynchronously receive the responses to requests sent by the main loop.void
run()
void
setConnFactory(ConnectionFactory connFactory)
void
setMaxCount(int maxCount)
void
setPassword(String password)
void
setRequestQueue(Destination requestQueue)
void
setSleepTime(long sleepTime)
void
setUsername(String username)
void
stop()
-
-
-
Field Detail
-
logger
private static final org.slf4j.Logger logger
-
connFactory
protected ConnectionFactory connFactory
-
requestQueue
protected Destination requestQueue
-
stop
protected boolean stop
-
stopped
protected boolean stopped
-
started
protected boolean started
-
count
protected int count
-
name
protected String name
-
sleepTime
protected long sleepTime
-
maxCount
protected int maxCount
-
responseCount
protected int responseCount
-
startTime
protected long startTime
-
username
protected String username
-
password
protected String password
-
-
Constructor Detail
-
Requestor
public Requestor(String name)
-
-
Method Detail
-
setConnFactory
public void setConnFactory(ConnectionFactory connFactory)
-
setRequestQueue
public void setRequestQueue(Destination requestQueue)
-
getCount
public int getCount()
-
setSleepTime
public void setSleepTime(long sleepTime)
-
setMaxCount
public void setMaxCount(int maxCount)
-
clearMessages
public void clearMessages()
-
stop
public void stop()
-
isStopped
public boolean isStopped()
-
isStarted
public boolean isStarted()
-
createContext
protected JMSContext createContext(Integer sessionMode) throws Exception
- Throws:
Exception
-
setUsername
public void setUsername(String username)
-
setPassword
public void setPassword(String password)
-
onMessage
public void onMessage(Message message)
This method is used to asynchronously receive the responses to requests sent by the main loop.- Specified by:
onMessage
in interfaceMessageListener
-
main
public static void main(String[] args)
-
-