Class SCPublishService

java.lang.Object
org.serviceconnector.api.cln.SCService
org.serviceconnector.api.cln.SCPublishService
Direct Known Subclasses:
SCGuardianService

public class SCPublishService extends SCService
The Class PublishService. PublishService is a remote interface in client API to a publish service and provides communication functions. Creating a publish service instance for API users should be done by calling SCClient newPublishService().

State Diagram

        ||                                                        |-----receive publication-------|
        \/                                                        |                               |
    |---------|              |----------|                   |---------------|                     |
    | initial |----attach--->| attached |-----subscribe---->| subscribed to |------change-----|   |
    |         |<---detach----|          |<---unsubscribe----|    service    |<--subscription--|   |
    |---------|              |----------|                   |---------------|<--------------------|
        ||
        \/
 
After subscribing the service an unsubscribe must follow in every case at the end of communication. Unsubscribe may be called multiple times. Nothing happens if the subscription turns inactive in meantime.
Author:
JTraber
  • Field Details

    • noDataIntervalSeconds

      protected int noDataIntervalSeconds
      The no data interval seconds.Interval in seconds the SC will wait to deliver RECEIVE_PUBLICATION response with noData flag set. Default = 0.
    • receivePublicationTimeoutSeconds

      protected int receivePublicationTimeoutSeconds
      The receive publication timeout in seconds. Time to wait for the reply of SC in case of a receive publication until the subscription is marked as dead.
  • Method Details

    • subscribe

      public SCSubscribeMessage subscribe(SCSubscribeMessage scSubscribeMessage, SCMessageCallback scMessageCallback) throws SCServiceException, SCMPValidatorException
      Subscribe to SC with default operation timeout.
      Once a subscribe is called a unsubscribe need to be done at the end of a communication.
      Parameters:
      scSubscribeMessage - the SC subscribe message
      scMessageCallback - the SC message callback
      Returns:
      the SC subscribe message
      Throws:
      SCMPValidatorException - subscribe message is null
      callback is null
      mask is invalid
      SCServiceException - instance already subscribed before
      subscribe to host failed
      error message received from SC
    • subscribe

      public SCSubscribeMessage subscribe(int operationTimeoutSeconds, SCSubscribeMessage scSubscribeMessage, SCMessageCallback scMessageCallback) throws SCServiceException, SCMPValidatorException
      Subscribe to SC.
      Once a subscribe is called a unsubscribe need to be done at the end of a communication.
      Parameters:
      operationTimeoutSeconds - the allowed time in seconds to complete the operation
      scSubscribeMessage - the SC subscribe message
      scMessageCallback - the SC message callback
      Returns:
      the SC subscribe message
      Throws:
      SCMPValidatorException - subscribe message is null
      callback is null
      mask is invalid
      SCServiceException - instance already subscribed before
      subscribe to host failed
      error message received from SC
    • changeSubscription

      public SCSubscribeMessage changeSubscription(SCSubscribeMessage scSubscribeMessage) throws SCServiceException, SCMPValidatorException
      Change subscription on SC with default operation timeout.
      Parameters:
      scSubscribeMessage - the SC subscribe message
      Returns:
      the SC subscribe message
      Throws:
      SCMPValidatorException - subscribe message is null
      mask not valid
      SCServiceException - instance not subscribed
      change subscription to host failed
      error message received from SC
    • changeSubscription

      public SCSubscribeMessage changeSubscription(int operationTimeoutSeconds, SCSubscribeMessage scSubscribeMessage) throws SCServiceException, SCMPValidatorException
      Change subscription on SC.
      Parameters:
      operationTimeoutSeconds - the allowed time in seconds to complete the operation
      scSubscribeMessage - the SC subscribe message
      Returns:
      the SC subscribe message
      Throws:
      SCMPValidatorException - subscribe message is null
      mask not valid
      SCServiceException - instance not subscribed
      change subscription to host failed
      error message received from SC
    • unsubscribe

      public void unsubscribe() throws SCServiceException
      Unsubscribe from SC with default operation timeout. Unsubscribe may be called multiple times. Nothing happens if the subscription turns inactive in meantime.
      Throws:
      SCServiceException - unsubscribe from SC failed
      error message received from SC
    • unsubscribe

      public void unsubscribe(SCMessage scMessage) throws SCServiceException
      Unsubscribe from SC. Unsubscribe may be called multiple times. Nothing happens if the subscription turns inactive in meantime.
      Parameters:
      scMessage - the SC message
      Throws:
      SCServiceException - unsubscribe from SC failed
      error message received from SC
    • unsubscribe

      public void unsubscribe(int operationTimeoutSeconds) throws SCServiceException
      Unsubscribe from SC. Unsubscribe may be called multiple times. Nothing happens if the subscription turns inactive in meantime.
      Parameters:
      operationTimeoutSeconds - the allowed time in seconds to complete the operation
      Throws:
      SCServiceException - unsubscribe from SC failed
      error message received from SC
    • unsubscribe

      public void unsubscribe(int operationTimeoutSeconds, SCMessage scMessage) throws SCServiceException
      Unsubscribe from SC. Unsubscribe may be called multiple times. Nothing happens if the subscription turns inactive in meantime.
      Parameters:
      operationTimeoutSeconds - the allowed time in seconds to complete the operation
      scMessage - the SC message
      Throws:
      SCServiceException - unsubscribe from SC failed
      error message received from SC
    • isSubscribed

      public boolean isSubscribed()
      Checks if is subscribed.
      Returns:
      true, if is subscribed
    • setReceivePublicationTimeoutSeconds

      public void setReceivePublicationTimeoutSeconds(int receivePublicationTimeoutSeconds) throws SCMPValidatorException, SCServiceException
      Sets the receive publication timeout in seconds. Time in seconds a receive publication request waits to be confirmed. If no confirmation is received subscription is marked as dead.
      Parameters:
      receivePublicationTimeoutSeconds - time to wait for completion of a receive publication request Example: 10
      Throws:
      SCMPValidatorException - receivePublicationTimeoutSeconds > 1 and < 3600
      SCServiceException - called method after subscribe
    • getReceivePublicationTimeoutSeconds

      public int getReceivePublicationTimeoutSeconds()
      Gets the receive publication timeout in seconds. Time in seconds a receive publication request waits to be confirmed.
      Returns:
      the receive publication timeout in seconds