Package org.serviceconnector.api.cln
Class SCPublishService
java.lang.Object
org.serviceconnector.api.cln.SCService
org.serviceconnector.api.cln.SCPublishService
- Direct Known Subclasses:
SCGuardianService
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
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 Summary
FieldsModifier and TypeFieldDescriptionprotected intThe no data interval seconds.Interval in seconds the SC will wait to deliver RECEIVE_PUBLICATION response with noData flag set.protected intThe receive publication timeout in seconds.Fields inherited from class org.serviceconnector.api.cln.SCService
messageCallback, pendingRequest, requester, scClient, serviceName, sessionActive, sessionId -
Method Summary
Modifier and TypeMethodDescriptionchangeSubscription(int operationTimeoutSeconds, SCSubscribeMessage scSubscribeMessage) Change subscription on SC.changeSubscription(SCSubscribeMessage scSubscribeMessage) Change subscription on SC with default operation timeout.intGets the receive publication timeout in seconds.booleanChecks if is subscribed.voidsetReceivePublicationTimeoutSeconds(int receivePublicationTimeoutSeconds) Sets the receive publication timeout in seconds.subscribe(int operationTimeoutSeconds, SCSubscribeMessage scSubscribeMessage, SCMessageCallback scMessageCallback) Subscribe to SC.subscribe(SCSubscribeMessage scSubscribeMessage, SCMessageCallback scMessageCallback) Subscribe to SC with default operation timeout.voidUnsubscribe from SC with default operation timeout.voidunsubscribe(int operationTimeoutSeconds) Unsubscribe from SC.voidunsubscribe(int operationTimeoutSeconds, SCMessage scMessage) Unsubscribe from SC.voidunsubscribe(SCMessage scMessage) Unsubscribe from SC.Methods inherited from class org.serviceconnector.api.cln.SCService
getSCClient, getServiceName, getSessionId, isActive
-
Field Details
-
noDataIntervalSeconds
protected int noDataIntervalSecondsThe 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 receivePublicationTimeoutSecondsThe 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 messagescMessageCallback- the SC message callback- Returns:
- the SC subscribe message
- Throws:
SCMPValidatorException- subscribe message is null
callback is null
mask is invalidSCServiceException- 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 operationscSubscribeMessage- the SC subscribe messagescMessageCallback- the SC message callback- Returns:
- the SC subscribe message
- Throws:
SCMPValidatorException- subscribe message is null
callback is null
mask is invalidSCServiceException- 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 validSCServiceException- 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 operationscSubscribeMessage- the SC subscribe message- Returns:
- the SC subscribe message
- Throws:
SCMPValidatorException- subscribe message is null
mask not validSCServiceException- instance not subscribed
change subscription to host failed
error message received from SC
-
unsubscribe
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
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
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
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 operationscMessage- 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 < 3600SCServiceException- 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
-