Class JmsConnectorService

java.lang.Object
org.eclipse.scanning.connector.jms.JmsConnectorService
All Implemented Interfaces:
IEventConnectorService, IMessagingService

public class JmsConnectorService extends Object implements IEventConnectorService, IMessagingService
This class is temporarily in this plugin and needs to be moved out of it once: 1. We move the ActiveMQ dependency to bundle imports rather than jar file. 2. We create a bundle called org.eclipse.scanning.event.activemq to donate the dependency 3. We start the scanning eclipse project and get ActiveMQ ip checked (rather large unless already done might be hard).

JSON marshalling is done by delegating to the new JsonMarshaller service which encapsulates all JSON interactions behind one cohesive interface.

  • Constructor Details

    • JmsConnectorService

      public JmsConnectorService()
      Default public constructor - for testing purposes only! Otherwise use OSGi to get the service.
  • Method Details

    • setJsonMarshaller

      public void setJsonMarshaller(IMarshallerService jsonMarshaller)
    • setFilePathService

      public void setFilePathService(IFilePathService filePathService)
    • setSessionService

      public void setSessionService(uk.ac.diamond.mq.ISessionService sessionService)
    • getSessionService

      public uk.ac.diamond.mq.ISessionService getSessionService()
      Description copied from interface: IEventConnectorService
      Return a service responsible for managing Connections, Sessions
      Specified by:
      getSessionService in interface IEventConnectorService
      Returns:
    • marshal

      public String marshal(Object anyObject) throws Exception
      Description copied from interface: IEventConnectorService
      May be used to use the serializer to marshal any object using its serialization routine. This can be used for objects other than T
      Specified by:
      marshal in interface IEventConnectorService
      Returns:
      Throws:
      Exception
    • unmarshal

      public <U> U unmarshal(String json, Class<U> beanClass) throws Exception
      Description copied from interface: IEventConnectorService
      May be used to get the serializer to unmarshal any object using its serialization routine. This can be used for objects other than T
      Specified by:
      unmarshal in interface IEventConnectorService
      Returns:
      Throws:
      Exception
    • getPersistenceDir

      public String getPersistenceDir()
      Description copied from interface: IEventConnectorService
      Returns the path of the directory to use for persistence.
      Specified by:
      getPersistenceDir in interface IEventConnectorService
      Returns:
    • start

      public URI start(String suggestedURI) throws EventException
      Description copied from interface: IMessagingService
      Start messaging, usually activemq programmatically.
      Specified by:
      start in interface IMessagingService
      Parameters:
      suggestedURI - where to attempt to make the connection
      The - activemq connector uri, for instance: "failover:(tcp://localhost:61616)?startupMaxReconnectAttempts=3" The failover:() is stipped out so that a tcp:// uri is created for the server.
      Returns:
      the host and remote port on which the server was started. If a unique port is looked for during the connection then this will be returned rather than the input URI's port.
      Throws:
      EventException
    • stop

      public void stop() throws EventException
      Description copied from interface: IMessagingService
      Stop messaging, usually activemq programmatically.
      Specified by:
      stop in interface IMessagingService
      Throws:
      EventException
    • isPortFree

      public static boolean isPortFree(int port)
      Checks if a port is free.
      Parameters:
      port -
      Returns: