Search in sources :

Example 1 with StartActivityException

use of javax.slee.resource.StartActivityException in project charging-server by RestComm.

the class HTTPClientSbb method getRateForServiceAsync.

public RatingInfo getRateForServiceAsync(HashMap params) {
    String sessionIdFromRequest = params.get("SessionId").toString();
    HttpClientActivity clientActivity = null;
    try {
        clientActivity = raSbbInterface.createHttpClientActivity(true, null);
    } catch (StartActivityException e) {
        tracer.severe("[xx] Failed creating HTTP Client Activity to send HTTP Request to Rating Engine.");
        return new RatingInfo(-1, sessionIdFromRequest);
    }
    ActivityContextInterface clientAci = httpClientAci.getActivityContextInterface(clientActivity);
    clientAci.attach(sbbContext.getSbbLocalObject());
    params.put("startTime", System.currentTimeMillis());
    HttpPost httpPost = buildHTTPRequest(params);
    // Asynchronous call
    clientActivity.execute(httpPost, params);
    tracer.info("[>>] Sent HTTP Request to Rating Client in asynchronous mode.");
    return null;
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) RatingInfo(org.mobicents.charging.server.ratingengine.RatingInfo) ActivityContextInterface(javax.slee.ActivityContextInterface) HttpClientActivity(net.java.client.slee.resource.http.HttpClientActivity) StartActivityException(javax.slee.resource.StartActivityException)

Aggregations

ActivityContextInterface (javax.slee.ActivityContextInterface)1 StartActivityException (javax.slee.resource.StartActivityException)1 HttpClientActivity (net.java.client.slee.resource.http.HttpClientActivity)1 HttpPost (org.apache.http.client.methods.HttpPost)1 RatingInfo (org.mobicents.charging.server.ratingengine.RatingInfo)1