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 Summary
ConstructorsConstructorDescriptionDefault public constructor - for testing purposes only! Otherwise use OSGi to get the service. -
Method Summary
Modifier and TypeMethodDescriptionReturns the path of the directory to use for persistence.uk.ac.diamond.mq.ISessionServiceReturn a service responsible for managing Connections, Sessionsstatic booleanisPortFree(int port) Checks if a port is free.May be used to use the serializer to marshal any object using its serialization routine.voidsetFilePathService(IFilePathService filePathService) voidsetJsonMarshaller(IMarshallerService jsonMarshaller) voidsetSessionService(uk.ac.diamond.mq.ISessionService sessionService) Start messaging, usually activemq programmatically.voidstop()Stop messaging, usually activemq programmatically.<U> UMay be used to get the serializer to unmarshal any object using its serialization routine.
-
Constructor Details
-
JmsConnectorService
public JmsConnectorService()Default public constructor - for testing purposes only! Otherwise use OSGi to get the service.
-
-
Method Details
-
setJsonMarshaller
-
setFilePathService
-
setSessionService
public void setSessionService(uk.ac.diamond.mq.ISessionService sessionService) -
getSessionService
public uk.ac.diamond.mq.ISessionService getSessionService()Description copied from interface:IEventConnectorServiceReturn a service responsible for managing Connections, Sessions- Specified by:
getSessionServicein interfaceIEventConnectorService- Returns:
-
marshal
Description copied from interface:IEventConnectorServiceMay 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:
marshalin interfaceIEventConnectorService- Returns:
- Throws:
Exception
-
unmarshal
Description copied from interface:IEventConnectorServiceMay 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:
unmarshalin interfaceIEventConnectorService- Returns:
- Throws:
Exception
-
getPersistenceDir
Description copied from interface:IEventConnectorServiceReturns the path of the directory to use for persistence.- Specified by:
getPersistenceDirin interfaceIEventConnectorService- Returns:
-
start
Description copied from interface:IMessagingServiceStart messaging, usually activemq programmatically.- Specified by:
startin interfaceIMessagingService- Parameters:
suggestedURI- where to attempt to make the connectionThe- 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
Description copied from interface:IMessagingServiceStop messaging, usually activemq programmatically.- Specified by:
stopin interfaceIMessagingService- Throws:
EventException
-
isPortFree
public static boolean isPortFree(int port) Checks if a port is free.- Parameters:
port-- Returns:
-