public interface ISpendingStatusReportListener
Java interface enables a monitoring client to be notified of spending status reports during
customer service usage.
StatefulServiceClient class
or in the AsyncStatefulServiceClient class to see how to implement this ISpendingStatusReportListener interface.
Example
You develop a connector plugged to a Policy Control Rule Function (PCRF) system. In your Java-based client application, you implement a listener that is dedicated to handle spending status report notifications sent by the SAP CC system as Online Charging System (OCS).
The listener is stateless and only forward the spending status report notifications to different downstream network elements.
It selects the appropriate network element by using the ssrlId information
specified by a monitoring client.
registerSpendingStatusReportListener(..) method in the StatefulServiceClient class or
the AsyncStatefulServiceClient.registerSpendingStatusReportListener(byte, ISpendingStatusReportListener) method.
Your client application must implement this ISpendingStatusReportListener interface to be able to handle spending status report notifications
during charging operations.
The implementation of this interface allows the SAP CC system to inform the client application that the label values of spending status changed during a charging.
The client application can handle this use case by implementing an ISpendingStatusReportListener and attaching it to the monitoring client.
The ISpendingStatusReportListener interface defines a unique method to handle the notification: onSpendingStatusReport().
This method provides the necessary parameters to handle the report:
IReservationRenewalAcknowledger object that must be used to acknowledge the receipt of this report
The acknowledger is an optional feature allowing the client application to tell the SAP CC system the report has been received and handled.
This feature is useful when the SPENDING_STATUS_RESEND_ATTEMPTS parameter of the SAP CC system is set with a positive and non zero value.
Once the SAP CC system is acknowledged by the client application, the resend procedure is canceled for this report.
Consult the SAP CC Configuration and Implementation Guide to know the necessary configuration settings of the SAP CC system that relates to the spending status report function available in the charging services.
Code Snippet
The following code snippet provides an example of how to implement an ISpendingStatusReportListener interface to receive and handle a spending status report notification:
private class MySpendingStatusReportListener implements ISpendingStatusReportListener {
public void onSpendingStatusReport(String monitoringId,
List<SpendingStatus> spendingStatusList,
short resendAttempt,
ISpendingStatusReportAcknowledger spendingStatusReportAcknowledger) {
// Simple implementation: print notification to console
System.out.println("spending status report received");
// Display the identifier of the spending status monitoring
System.out.println("The identifier of the spending status monitoring \"" + monitoringId + "\");
// Display the number of send that the resent mechanism has already done
System.out.println("The resend mechanism has already sent "+resendAttempt+" time(s) this report");
// Display each spending status with their last label value
for(SpendingStatus spendingStatus : spendingStatusList){
System.out.println("The spending status \"" + spendingStatus.getId() + "\" has a new label value : \"" + spendingStatus.getLabel() + "\"");
}
// (Optional) Acknowledge the handling message
ISpendingStatusReportAcknowledgerListener acknowledgerListener = new ISpendingStatusReportAcknowledgerListener(){
public void onResult(){
System.out.println("This spending status report will not be sent anymore");
}
public void onException(CommunicationFailureException e){
System.out.println("An error occurred during the acknowledgment of this spending status report: "+e.getMessage());
}
public void onException(IllegalArgumentException e){
System.out.println("An error occurred during the acknowledgment of this spending status report: "+e.getMessage());
}
public void onException(ServerFailureException e){
System.out.println("An error occurred during the acknowledgment of this spending status report: "+e.getMessage());
}
};
// Acknowledge to stop the resend mechanism
System.out.println("Acknowledge to stop resending this report");
spendingStatusReportAcknowledger.ack(acknowledgerListener);
}
}
StatefulServiceClient,
AsyncStatefulServiceClient| Modifier and Type | Method and Description |
|---|---|
void |
onSpendingStatusReport(java.lang.String monitoringId,
java.util.List<SpendingStatus> spendingStatusList,
short resendAttempt,
ISpendingStatusReportAcknowledger spendingStatusReportAcknowledger)
Invoked each time a spending status report must be managed by the stateful service client.
|
void onSpendingStatusReport(java.lang.String monitoringId,
java.util.List<SpendingStatus> spendingStatusList,
short resendAttempt,
ISpendingStatusReportAcknowledger spendingStatusReportAcknowledger)
monitoringId - The identifier of the spending status monitoringspendingStatusList - The list of spending status that have changedresendAttempt - The number of resends already carried out for this spending status reportspendingStatusReportAcknowledger - An implementation of ISpendingStatusReportAcknowledger must be provided if the
SAP CC system is configured to resend spending status report.
A business acknowledgement
is expected to end further resend of spending status reports.