Class AsyncStatefulServiceClientCtrl

java.lang.Object
com.highdeal.cnd.message.AsyncStatefulServiceClientCtrl
All Implemented Interfaces:
ClientOpEventListener

public class AsyncStatefulServiceClientCtrl extends Object implements ClientOpEventListener
This class represents a 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.
It is possible to enable the average latency controller. But the expected latency cannot be lower than the system's minimum. This can decrease the charging operation throughput.

Performance Management

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.
    • The value of queueSizeToNotify must be strictly less than maxQueueSizeToWait. It must be a non-null value.

Recommendation

During the implementation project phase:

  • You set up the maximum queue size to wait (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
    • In case 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.
  • You set up the queue size to notify (queueSizeToNotify) with around 90% of the value maxQueueSizeToWait.
Refer to the SAP CC System Parameter Reference for more information about this system parameter.

Implementation in Your Client Application

Code Snippet

Here is an example of use:

      AsyncStatefulServiceClient client = new AsyncStatefulServiceClient();
      client.setClientOpEventListener(ClientOpEventTopic.DEFAULT, new AsyncStatefulServiceClientCtrl());
 

Notes on SAP CC Implementation

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.

  • Field Details

    • QUEUE_SIZE_TO_WAIT_DEFAULT_VALUE

      public static final int QUEUE_SIZE_TO_WAIT_DEFAULT_VALUE
      See Also:
    • QUEUE_SIZE_TO_NOTIFY_DEFAULT_VALUE

      public static final int QUEUE_SIZE_TO_NOTIFY_DEFAULT_VALUE
      See Also:
    • MIN_QUEUE_SIZE_TO_WAIT_VALUE

      public static final int MIN_QUEUE_SIZE_TO_WAIT_VALUE
      See Also:
    • MIN_QUEUE_SIZE_TO_NOTIFY_VALUE

      public static final int MIN_QUEUE_SIZE_TO_NOTIFY_VALUE
      See Also:
  • Constructor Details

    • AsyncStatefulServiceClientCtrl

      public AsyncStatefulServiceClientCtrl()
      This is an equivalent of AsyncStatefulServiceClientCtrl(AsyncStatefulServiceClientCtrl.QUEUE_SIZE_TO_WAIT_DEFAULT_VALUE, AsyncStatefulServiceClientCtrl.MIN_QUEUE_SIZE_TO_NOTIFY_VALUE)
    • AsyncStatefulServiceClientCtrl

      public AsyncStatefulServiceClientCtrl(int queueSizeToWait, int queueSizeToNotify)
      The queueSizeToWait is the maximum number of waiting requests to be executed by the servers. Additional requests make the client waiting. When the number of waiting requests get lower or equal to queueSizeToNotify and at least one client waits, all the clients are woke up.
      Parameters:
      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.
  • Method Details

    • setClientQueueListenerSize

      public 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. The minQueueSizeToWait, maxQueueSizeToWait is couple of minimal, maximum values used to adapt queueSizeToWait according to expected latency. When the number of waiting requests get lower or equal to queueSizeToNotify and at least one client waits, all the clients are woke up.
      Parameters:
      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.
    • onLookupResult

      public void onLookupResult(ClientOpEventInformation clientOpInfo)
      Description copied from interface: ClientOpEventListener
      Called when the guiding lookup result is received.
      Specified by:
      onLookupResult in interface ClientOpEventListener
      Parameters:
      clientOpInfo - The ClientOpEventInformation that generated the event.
    • onLookupStart

      public ClientOpEventInformation onLookupStart(ClientOpEventTopic topic)
      Description copied from interface: ClientOpEventListener
      Called before the guiding lookup only if the the guiding lookup is the first action of the client operation.
      Specified by:
      onLookupStart in interface ClientOpEventListener
      Parameters:
      topic - the ClientOpEventTopic of the event.
    • onOpStart

      public ClientOpEventInformation onOpStart(ClientOpEventTopic topic)
      Description copied from interface: ClientOpEventListener
      Called when an operation start only if the first operation is not a guiding lookup.
      Specified by:
      onOpStart in interface ClientOpEventListener
      Parameters:
      topic - the ClientOpEventTopic of the event.
    • onLookupException

      public void onLookupException(ClientOpEventInformation clientOpInfo)
      Description copied from interface: ClientOpEventListener
      Called if an exception is raised during the guiding lookup before giving a response to the client.
      Specified by:
      onLookupException in interface ClientOpEventListener
      Parameters:
      clientOpInfo - The ClientOpEventInformation that generated the event.
    • onOpResult

      public void onOpResult(ClientOpEventInformation clientOpInfo)
      Description copied from interface: ClientOpEventListener
      Called when the operation result is received.
      Specified by:
      onOpResult in interface ClientOpEventListener
      Parameters:
      clientOpInfo - The ClientOpEventInformation that generated the event.
    • onOpException

      public void onOpException(ClientOpEventInformation clientOpInfo)
      Description copied from interface: ClientOpEventListener
      Called if an exception is raised during the operation execution before giving a response to the client.
      Specified by:
      onOpException in interface ClientOpEventListener
      Parameters:
      clientOpInfo - The ClientOpEventInformation that generated the event.
    • onOpStartAnotherOperation

      public void onOpStartAnotherOperation(ClientOpEventInformation clientOpInfo)
      Description copied from interface: ClientOpEventListener
      Called when a failed operation implies to call another operation.
      Specified by:
      onOpStartAnotherOperation in interface ClientOpEventListener
      Parameters:
      clientOpInfo - The ClientOpEventInformation that generated the event.