The Rf Control RA provides a Rhino TAS API that allows a client application to send Diameter Rf messages. The following example shows a Service with a single SBB using the API.
@SleeService( id = @ComponentId(name="ExampleRfControl", vendor="OpenCloud", version="1.0"), rootSbb = @RootSBB(sbb = @ComponentId(name="ExampleRfControl", vendor="OpenCloud", version="1.0")) ) @SBB( id = @ComponentId(name="ExampleRfControl", vendor="OpenCloud", version="1.0"), sbbClasses = @SBBClasses(), raTypes = { @RATypeBinding( raType = @ComponentId(name = "rf-control-ratype", vendor = "OpenCloud", version = "1.0.0"), activityContextInterfaceFactoryName = "rf-control-ra/activitycontextinterfacefactory", resourceAdaptorEntityLink = "rf-control-ra", resourceAdaptorObjectName = "rf-control-ra/provider" ) } ) public abstract class ExampleRfControl implements Sbb { @Override public void setSbbContext(SbbContext context) { tracer = context.getTracer("example.rf-control"); this.context = context; try { /* Get Rf control facilities */ final Context env = (Context) new InitialContext().lookup("java:comp/env"); this.profileFacility = (ProfileFacility) env.lookup(ProfileFacility.JNDI_NAME); this.rfControlProvider = (RfControlProvider) env.lookup("rf-control-ra/provider"); this.rfControlACIFactory = (RfControlActivityContextInterfaceFactory) env.lookup("rf-control-ra/activitycontextinterfacefactory"); } catch (NamingException e) { throw new RuntimeException("Got NamingException trying to locate facilities", e); } } private void exampleCall() { final RfMessageFactory rfMessageFactory = rfControlProvider.getRfMessageFactory(); tracer.fine("Creating the the message"); final AccountingRequest startAcr, interimAcr1, interimAcr2, stopAcr; try { /* Create simple Rf messages */ startAcr = buildACR(roMessageFactory, rfMessageFactory, AccountingRecordType.START_RECORD); interimAcr1 = buildACR(roMessageFactory, rfMessageFactory, AccountingRecordType.INTERIM_RECORD); interimAcr2 = buildACR(roMessageFactory, rfMessageFactory, AccountingRecordType.INTERIM_RECORD); stopAcr = buildACR(rfMessageFactory, AccountingRecordType.STOP_RECORD); } catch (Exception e) { tracer.warning("Failed to send ACR due to an exception", e); sendHttpResponse(requestActivity, aci, HTTP_SERVER_ERROR, "Internal Error", "Failed to send ACR due to an exception: " + e.toString()); return; } tracer.fine("Sending the the message"); try { /* Send Rf messages */ final RfControlActivity rfControlActivity = rfControlProvider.newSession(); rfControlActivity.sendAccountingRequest(startAcr); rfControlActivity.sendAccountingRequest(interimAcr1); rfControlActivity.sendAccountingRequest(interimAcr2); rfControlActivity.sendAccountingRequest(stopAcr); } catch (Exception e) { tracer.warning("Failed to send ACR due to an exception", e); return; } } private AccountingRequest buildACR(RfMessageFactory rfMessageFactory, AccountingRecordType type) throws Exception { final AccountingRequest acr = rfMessageFactory.createRfAccountingRequest(type); final ServiceInformation serviceInformation = rfMessageFactory.createServiceInformation(); final ImsInformation imsInformation = rfMessageFactory.createImsInformation(NodeFunctionality.AS); final SubscriptionId subscriptionId = rfMessageFactory.createSubscriptionId(SubscriptionIdType.END_USER_E164, "tel:1234"); serviceInformation.setSubscriptionId(subscriptionId); serviceInformation.setImsInformation(imsInformation); acr.setServiceInformation(serviceInformation); return acr; } }
The client application needs to have an RA Type Binding and RA Entity link binding to retrieve the Rf Control Provider via JNDI. Once this setup has occurred the primary interfaces for the application are the:
-
RfMessageFactory
(to create Rf requests), and -
RfControlActivity
(to send requests on a logical Rf session) .
The RfMessageFactory
exposes the underlying Diameter Rf factory to create all necessary requests and AVPs.
Once an AccountingRequest
has been created and populated, it can be sent via an RfControlActivity
.
For more detailed information see: