Class AbstractJobQueueServlet<T extends StatusBean>

java.lang.Object
org.eclipse.scanning.server.servlet.AbstractJobQueueServlet<T>
Type Parameters:
T - the type of bean consumed by this servlet
All Implemented Interfaces:
AutoCloseable, IConnection, IConnectable, IJobQueueServlet<T>
Direct Known Subclasses:
HeterogeneousScanServlet, ScanServlet

public abstract class AbstractJobQueueServlet<T extends StatusBean> extends Object implements IJobQueueServlet<T>
Class used to register a servlet Spring config started servlets, for instance:

    <bean id="scanPerformer" class="org.eclipse.scanning.server.servlet.ScanServlet" init-method="connect">
       <property name="broker"      value="tcp://p45-control:61616" />
       <property name="submitQueue" value="uk.ac.diamond.p45.submitQueue" />
       <property name="statusSet"   value="uk.ac.diamond.p45.statusSet"   />
       <property name="statusTopic" value="uk.ac.diamond.p45.statusTopic" />
       <property name="durable"     value="true" />
    </bean>

    Use: property name="purgeQueue" value="false" to stop the startup phase purging old inactive jobs.

    
  • Field Details

    • eventService

      protected IEventService eventService
    • broker

      protected String broker
    • submitQueue

      protected String submitQueue
    • statusTopic

      protected String statusTopic
    • queueStatusTopic

      protected String queueStatusTopic
    • commandTopic

      protected String commandTopic
    • commandAckTopic

      protected String commandAckTopic
    • jobQueue

      protected IJobQueue<T extends StatusBean> jobQueue
  • Constructor Details

    • AbstractJobQueueServlet

      protected AbstractJobQueueServlet()
    • AbstractJobQueueServlet

      protected AbstractJobQueueServlet(String submitQueue, String statusTopic)
  • Method Details

    • connect

      @PostConstruct public void connect() throws EventException, URISyntaxException
      Description copied from interface: IConnectable
      Should called to start the servlet.
      Specified by:
      connect in interface IConnectable
      Throws:
      EventException
      URISyntaxException
    • getName

      protected abstract String getName()
    • disconnect

      @PreDestroy 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.
    • getJobQueue

      public IJobQueue<T> getJobQueue()
    • getBroker

      public String getBroker()
    • setBroker

      public void setBroker(String uri)
    • getSubmitQueue

      public String getSubmitQueue()
    • setSubmitQueue

      public void setSubmitQueue(String submitQueue)
    • getStatusTopic

      public String getStatusTopic()
    • setStatusTopic

      public void setStatusTopic(String statusTopic)
    • getQueueStatusTopic

      public String getQueueStatusTopic()
    • setQueueStatusTopic

      public void setQueueStatusTopic(String queueStatusTopic)
    • getCommandTopic

      public String getCommandTopic()
    • setCommandTopic

      public void setCommandTopic(String commandTopic)
    • getCommandAckTopic

      public String getCommandAckTopic()
    • isBlocking

      public boolean isBlocking()
    • setBlocking

      public void setBlocking(boolean blocking)
    • 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
    • isPurgeQueue

      public boolean isPurgeQueue()
    • setPurgeQueue

      public void setPurgeQueue(boolean purgeQueue)
    • setConsumer

      public void setConsumer(IJobQueue<T> jobQueue)
    • isPauseOnStart

      public boolean isPauseOnStart()
    • setPauseOnStart

      public void setPauseOnStart(boolean pauseOnStart)