Class EventsSocketClient


  • public class EventsSocketClient
    extends Object
    • Constructor Detail

      • EventsSocketClient

        public EventsSocketClient​(String host,
                                  boolean isSecureConnection,
                                  com.artisol.teneo.studio.api.resources.WebSocketsResource webSocketsResource)
        Client to establish the event channel connection.
        Parameters:
        host - server address
        isSecureConnection - indicates whether to use a secure connection.
        webSocketsResource - resource to retrieve the session token.
    • Method Detail

      • createEventsSocket

        public void createEventsSocket​(EventsHandler handler)
                                throws javax.websocket.DeploymentException,
                                       com.artisol.teneo.studio.api.exceptions.ResourceException
        Create a new event socket connection.
        Parameters:
        handler - An EventsHandler implementation to process the events.
        Throws:
        com.artisol.teneo.studio.api.exceptions.ResourceException - error on authentication.
        javax.websocket.DeploymentException - error on connection.
      • subscribeToLogDataSources

        public void subscribeToLogDataSources​(Set<UUID> logDataSourceIds)
                                       throws Exception
        Subscribe to get the events of one or more log data sources.
        Parameters:
        logDataSourceIds - a Set of log data source Ids to subscribe to.
        Throws:
        Exception - when sending the message fails.
      • unsubscribeToLogDataSources

        public void unsubscribeToLogDataSources​(Set<UUID> logDataSourceIds)
                                         throws Exception
        Unsubscribe to stop getting events from one or more log data sources.
        Parameters:
        logDataSourceIds - a Set of log data source Ids to subscribe to.
        Throws:
        Exception - when sending the message fails.
      • subscribeToSolutions

        public void subscribeToSolutions​(Set<UUID> solutionIds)
                                  throws Exception
        Subscribe to get the events of one or more Solution.
        Parameters:
        solutionIds - a Set of solution IDs to subscribe to.
        Throws:
        Exception - when sending the message fails.
      • unsubscribeToSolutions

        public void unsubscribeToSolutions​(Set<UUID> solutionIds)
                                    throws Exception
        Unsubscribe to stop getting events from one or more solutions.
        Parameters:
        solutionIds - a Set of solution IDs to unsubscribe to.
        Throws:
        Exception - when sending the message fails.
      • disconnect

        public void disconnect()
        Disconnect and close the socket connection. Also stops reconnecting the client.
      • isSessionAvailable

        public boolean isSessionAvailable()
                                   throws Exception
        Gets if the events' socket is connected and a session is available.
        Returns:
        true when a session is available, otherwise false.
        Throws:
        Exception - error when establishing a connection failed.