Class AbstractTopicConnection

java.lang.Object
org.eclipse.scanning.event.AbstractTopicConnection
All Implemented Interfaces:
AutoCloseable, IConnection, ITopicConnection, IURIConnection
Direct Known Subclasses:
AMQPSubscriberImpl

public abstract class AbstractTopicConnection extends Object implements ITopicConnection
Abstract superclass for objects that publish or subscribe to a topic.
  • Field Details

  • Method Details

    • createTopic

      protected javax.jms.Topic createTopic(String topicName) throws javax.jms.JMSException
      Creates and returns a topic of the given name
      Parameters:
      topicName -
      Returns:
      topic
      Throws:
      javax.jms.JMSException
    • getTopicName

      public String getTopicName()
      Description copied from interface: ITopicConnection
      The string topic to publish events on for this manager. The events will be beans which serialize to JSON.
      Specified by:
      getTopicName in interface ITopicConnection
      Returns:
      the topic name
    • setTopicName

      public void setTopicName(String topic)
    • getConnectorService

      public IEventConnectorService getConnectorService()
      Description copied from interface: IURIConnection
      The underlyng service which the uri is connected using
      Specified by:
      getConnectorService in interface IURIConnection
    • 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

      protected javax.jms.Queue createQueue(String queueName) throws javax.jms.JMSException
      Creates and returns a queue of the given name
      Parameters:
      queueName -
      Returns:
      Throws:
      javax.jms.JMSException
    • disconnect

      public void disconnect() throws EventException
      Description copied from interface: IConnection
      Call 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 method IConnection.close(), inherited from AutoCloseable calls this method, which means that if an object of a class implementing IConnection is used with a try-with-resources block this method will be called automatically when exiting that block.
      Specified by:
      disconnect in interface IConnection
      Throws:
      EventException - if resource could not be disconnected.
    • getUri

      public URI getUri()
      Description copied from interface: IURIConnection
      The URI of this connection.
      Specified by:
      getUri in interface IURIConnection
      Returns:
    • getSubmitQueueName

      public String getSubmitQueueName()
    • getStatusTopicName

      public String getStatusTopicName()
    • setStatusTopicName

      public void setStatusTopicName(String statusTopicName)
    • isForSameObject

      protected boolean isForSameObject(Object qbean, Object bean)
      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 using Object.equals(Object)
      Parameters:
      qbean -
      bean -
      Returns:
      true if the two beans represent the same object, false otherwise
    • isConnected

      public boolean isConnected()
      Description copied from interface: IConnection
      Returns whether this connection is connected. This method returns true until disconnect is called, even if the connection is created lazily.
      Specified by:
      isConnected in interface IConnection
      Returns:
      true if connected, false otherwise
    • setConnected

      protected void setConnected(boolean connected)