public class AsyncStatefulServiceClientCtrl extends Object implements ClientOpEventListener
client operation event listener able to supervise
the activity of the instances of the SAP CC Core Server system by limiting the number of operations in the server instances. You can fine tune the behavior of your client application for processing real-time charging services. The following advanced options are available:
maxQueueSizeToWait: This is the maximum number of requests to be sent that the AsyncStatefulServiceClient will hold at a given point of time.
This is used to avoid potential overflow of the connected SAP CC system.
Asking the AsyncStatefulServiceClient to send additional requests beyond this parameter value will cause the client to wait before sending the extra requests.
queueSizeToNotify: This is the maximum number of requests the AsyncStatefulServiceClient is awaiting a response for before it can send more requests to the connected SAP CC system.
This is used to avoid potential overflow of the connected SAP CC system.
Technically, if the number of requests already sent and not having received a response yet is greater than queueSizeToNotify, then no more additional requests will be sent by AsyncStatefulServiceClient.
When the number of requests without a response drops below queueSizeToNotify, then the pending requests in the sending queue are sent.
queueSizeToNotify must be strictly less than maxQueueSizeToWait. It must be a non-null value.
Recommendation
During the implementation project phase:
maxQueueSizeToWait) with the value of the STATEFUL_SERVICE_QUEUE_SIZE system parameter defined in
the dispatcher instances of the SAP CC system.
The dispatcher instances are the public endpoints of the Message TCP technical interface
multiple charging clients are used, the sum of all the queue sizes for all the clients shall
be equal to the value of the STATEFUL_SERVICE_QUEUE_SIZE system parameter defined in the dispatcher instances of the connected SAP CC system.
queueSizeToNotify) with around 90% of the value maxQueueSizeToWait.
Code Snippet
Here is an example of use:
AsyncStatefulServiceClient client = new AsyncStatefulServiceClient();
client.setClientOpEventListener(ClientOpEventTopic.DEFAULT, new AsyncStatefulServiceClientCtrl());
This fine-tuning depends on the fine-tuning of the connected SAP CC system. This system may be customized during the implementation project phase. Consider the values of the STATEFUL_SERVICE_QUEUE_SIZE system parameter. Consult the SAP CC System Parameter Reference for more information.
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_QUEUE_SIZE_TO_NOTIFY_VALUE |
static int |
MIN_QUEUE_SIZE_TO_WAIT_VALUE |
static int |
QUEUE_SIZE_TO_NOTIFY_DEFAULT_VALUE |
static int |
QUEUE_SIZE_TO_WAIT_DEFAULT_VALUE |
| Constructor and Description |
|---|
AsyncStatefulServiceClientCtrl()
This is an equivalent of AsyncStatefulServiceClientCtrl(AsyncStatefulServiceClientCtrl.QUEUE_SIZE_TO_WAIT_DEFAULT_VALUE, AsyncStatefulServiceClientCtrl.MIN_QUEUE_SIZE_TO_NOTIFY_VALUE)
|
AsyncStatefulServiceClientCtrl(int queueSizeToWait,
int queueSizeToNotify)
The queueSizeToWait is the maximum number of waiting requests to be executed by the servers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onLookupException(ClientOpEventInformation clientOpInfo)
Called if an exception is raised during the guiding lookup before giving a response to the client.
|
void |
onLookupResult(ClientOpEventInformation clientOpInfo)
Called when the guiding lookup result is received.
|
ClientOpEventInformation |
onLookupStart(ClientOpEventTopic topic)
Called before the guiding lookup only if the the guiding lookup is the first action of the client operation.
|
void |
onOpException(ClientOpEventInformation clientOpInfo)
Called if an exception is raised during the operation execution before giving a response to the client.
|
void |
onOpResult(ClientOpEventInformation clientOpInfo)
Called when the operation result is received.
|
ClientOpEventInformation |
onOpStart(ClientOpEventTopic topic)
Called when an operation start only if the first operation is not a guiding lookup.
|
void |
onOpStartAnotherOperation(ClientOpEventInformation clientOpInfo)
Called when a failed operation implies to call another operation.
|
void |
setClientQueueListenerSize(int maxQueueSizeToWait,
int minQueueSizeToWait,
int queueSizeToNotify,
long spotLatency)
The queueSizeToWait is the maximum number of waiting requests to be executed by the servers; Additional requests make the client waiting.
|
public static final int QUEUE_SIZE_TO_WAIT_DEFAULT_VALUE
public static final int QUEUE_SIZE_TO_NOTIFY_DEFAULT_VALUE
public static final int MIN_QUEUE_SIZE_TO_WAIT_VALUE
public static final int MIN_QUEUE_SIZE_TO_NOTIFY_VALUE
public AsyncStatefulServiceClientCtrl()
public AsyncStatefulServiceClientCtrl(int queueSizeToWait,
int queueSizeToNotify)
queueSizeToWait - The queueSizeToWait value, the minimal value is MIN_QUEUE_SIZE_TO_WAIT_VALUE.queueSizeToNotify - The queueSizeToNotify value, the minimal value is MIN_QUEUE_SIZE_TO_NOTIFY_VALUE
and the maximal value is the value of queueListenerSizeToWait parameter minus one.public void setClientQueueListenerSize(int maxQueueSizeToWait,
int minQueueSizeToWait,
int queueSizeToNotify,
long spotLatency)
maxQueueSizeToWait - The maxQueueSizeToWait value, the minimal value is MIN_QUEUE_SIZE_TO_WAIT_VALUE.minQueueSizeToWait - The minQueueSizeToWait value, the minimal value is MIN_QUEUE_SIZE_TO_WAIT_VALUE.queueSizeToNotify - The queueListenerSizeToNotify value, the minimal value is MIN_QUEUE_SIZE_TO_NOTIFY_VALUE
and the maximal value is the value of queueListenerSizeToWait parameter minus one.spotLatency - The expected average latency. The minimal value is 1 to enable the average latency controller.public void onLookupResult(ClientOpEventInformation clientOpInfo)
ClientOpEventListeneronLookupResult in interface ClientOpEventListenerclientOpInfo - The ClientOpEventInformation that generated the event.public ClientOpEventInformation onLookupStart(ClientOpEventTopic topic)
ClientOpEventListeneronLookupStart in interface ClientOpEventListenertopic - the ClientOpEventTopic of the event.public ClientOpEventInformation onOpStart(ClientOpEventTopic topic)
ClientOpEventListeneronOpStart in interface ClientOpEventListenertopic - the ClientOpEventTopic of the event.public void onLookupException(ClientOpEventInformation clientOpInfo)
ClientOpEventListeneronLookupException in interface ClientOpEventListenerclientOpInfo - The ClientOpEventInformation that generated the event.public void onOpResult(ClientOpEventInformation clientOpInfo)
ClientOpEventListeneronOpResult in interface ClientOpEventListenerclientOpInfo - The ClientOpEventInformation that generated the event.public void onOpException(ClientOpEventInformation clientOpInfo)
ClientOpEventListeneronOpException in interface ClientOpEventListenerclientOpInfo - The ClientOpEventInformation that generated the event.public void onOpStartAnotherOperation(ClientOpEventInformation clientOpInfo)
ClientOpEventListeneronOpStartAnotherOperation in interface ClientOpEventListenerclientOpInfo - The ClientOpEventInformation that generated the event.