Package org.eclipse.scanning.event
Class JmsQueueReader<U extends StatusBean>
java.lang.Object
org.eclipse.scanning.event.JmsQueueReader<U>
- All Implemented Interfaces:
AutoCloseable,IConnection,IJmsQueueReader<U>,IURIConnection
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IEventConnectorServiceprotected Stringprotected Stringprotected final URI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected javax.jms.QueuecreateQueue(String queueName) Creates and returns a queue of the given namevoidCall to disconnect any resources which we no longer need.The underlyng service which the uri is connected usingprotected javax.jms.QueueSessionprotected javax.jms.SessiongetUri()The URI of this connection.booleanReturns whether this connection is connected.protected booleanisForSameObject(Object qbean, Object bean) A utility method to test if a bean from the queue represents the same bean as that given .booleanvoidrun()protected voidprotected voidsetConnected(boolean connected) voidsetStatusTopicName(String statusTopicName) voidstart()voidstop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.scanning.api.event.core.IConnection
close, isConnected
-
Field Details
-
uri
-
submitQueueName
-
statusTopicName
-
service
-
-
Constructor Details
-
JmsQueueReader
- Throws:
EventException
-
-
Method Details
-
getQueueName
- Specified by:
getQueueNamein interfaceIJmsQueueReader<U extends StatusBean>
-
start
public void start()- Specified by:
startin interfaceIJmsQueueReader<U extends StatusBean>
-
runAndHandleError
protected void runAndHandleError() -
run
- Specified by:
runin interfaceIJmsQueueReader<U extends StatusBean>- Throws:
EventException
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceIJmsQueueReader<U extends StatusBean>
-
stop
public void stop()- Specified by:
stopin interfaceIJmsQueueReader<U extends StatusBean>
-
disconnect
Description copied from interface:IConnectionCall to disconnect any resources which we no longer need. The resource may have timed out so it might not be connected, in that case it silently returns. Note, that the methodIConnection.close(), inherited fromAutoCloseablecalls this method, which means that if an object of a class implementingIConnectionis used with a try-with-resources block this method will be called automatically when exiting that block.- Specified by:
disconnectin interfaceIConnection- Throws:
EventException- if resource could not be disconnected.
-
getConnectorService
Description copied from interface:IURIConnectionThe underlyng service which the uri is connected using- Specified by:
getConnectorServicein interfaceIURIConnection
-
getSession
protected javax.jms.Session getSession() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
getQueueSession
protected javax.jms.QueueSession getQueueSession() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createQueue
Creates and returns a queue of the given name- Parameters:
queueName-- Returns:
- Throws:
javax.jms.JMSException
-
getUri
Description copied from interface:IURIConnectionThe URI of this connection.- Specified by:
getUriin interfaceIURIConnection- Returns:
-
getSubmitQueueName
-
getStatusTopicName
-
setStatusTopicName
-
isForSameObject
A utility method to test if a bean from the queue represents the same bean as that given . This is done by comparing their uniqueIds, if present, and falls back on usingObject.equals(Object)- Parameters:
qbean-bean-- Returns:
trueif the two beans represent the same object,falseotherwise
-
isConnected
public boolean isConnected()Description copied from interface:IConnectionReturns whether this connection is connected. This method returnstrueuntil disconnect is called, even if the connection is created lazily.- Specified by:
isConnectedin interfaceIConnection- Returns:
trueif connected,falseotherwise
-
setConnected
protected void setConnected(boolean connected)
-