A Suspense Error Configuration Examples

This appendix provides two examples of how to configure Oracle Communications Offline Mediation Controller nodes to suspend records and batches.

Topics in this document:

For more information, see "Suspending and Recycling Records".

About These Examples

The following examples describe the NPL rule files for cartridges that detect event and batch CDR errors. Both examples use Java hook methods. For more information about Java hooks, see "Java Hooks" in Offline Mediation Controller Cartridge Development Kit Developer's Guide.

Product Type Error Event NPL Example

This example describes an NPL file for a node that detects and suspends event CDRs if the product type is incorrect.

Figure A-1 shows the processing flow of a CDR in a node chain that contains three nodes:

  1. Node A sends its output stream to the Product Check EP node.

  2. The Product Check EP node checks whether the product type is TEL or SMS.

  3. If the Product Check EP node does not detect any errors, it sends its output stream to Node B.

Figure A-1 Product Type Error Detection Flow

Description of Figure A-1 follows
Description of "Figure A-1 Product Type Error Detection Flow"

In the Product Check EP node, configure the NPL file with a flag value that outputs the CDR to one of the following:

  • If the product type is not valid, the CDR is made available for the Suspense DC node, which changes the status to a suspended state and generates a Create file for the SE Loader.

  • If the product type is valid, the CDR outputs to Node B.

  • If the product type is valid and the CDR is recycled, the CDR is made available for the Suspense DC node, which changes the status to a succeeded state and generates an Update file for SE Loader.

Table A-1 describes the NPL configuration for the Product Check EP node.

Table A-1 Product Check EP NPL

NPL Description
JavaHook suspHandler=oracle.communications.brm.nm.nplhook.SuspenseMethodHandlerImpl;

Java hook declaration.

InputRec { 
  String product_type;
  String calling_number;
} in;

Input stream from Node A.

OutputRec {
  String cdr_service;
  String eventType;
  String A_NUMBER;

Output stream to Node B.

  // internal flag
  Integer pSUSPENDED;
} out;

The routing Flag.

Expose for Routing {
  out.pSUSPENDED "susp";
}

Expose the routing flag and set the display name.

// initialize routing flag to 0
   out.pSUSPENDED=0;

Initialize the routing flag to 0, which if no errors are found sends the CDR to Node B.

if (in.product_type != "TEL" && in.product_type!="SMS") {
    // bad product type detected
    //   1) prepare output stream
    //   2) set suspended routing flag
    logInfo("inside wrong product type in.product_type=
       "+in.product_type);
    suspHandler.assemble(in, out, 5002, "ProductCheck",
    "ASCII");

If the product type is incorrect, call the assemble Java hook method to clone the input stream to the output stream and add suspense fields for the given error code of 5002, node name ProductCheck, and node category ASCII.

    out.pSUSPENDED=2;

Set the routing flag to 2, which directs the suspended CDR to the Suspense DC for suspense handling.

} else {
    // good product type
    logInfo("good product type in.product_type=
       "+in.product_type);
  
    // prepare output stream by assigning input values
    if(in.product_type=="TEL"){
       out.cdr_service="VOICE";
       out.eventType="USAGE";
    }else if(in.product_type=="SMS"){
       out.cdr_service="SMS";
       out.eventType="SMS_USAGE";
    }
    out.A_NUMBER=in.calling_number;

If the product type is correct, prepare the output stream based on the input stream.

    // if this NAR was previously suspended (from
       recycle)
    //   1) add suspense fields to output stream
    //   2) set suspended routing flag
    if (suspHandler.isRecycled(in)>0) {
       logInfo("key suspense fields found, copying..." );
       suspHandler.append(in, out);

If the product type is correct and any suspense fields exist, such as, SUSPENSE_ID, append the suspense fields to the output stream.

       out.pSUSPENDED=1;
   }

Set the routing flag to 1, which directs the CDR to:

  1. Node B to continue processing.

  2. Suspense DC, which updates the status to Successful.

 }
write(out);

Writes out the stream.

Batch CDR File Error NPL Example

This example describes an NPL file for a node that detects and suspends a batch CDR file if it contains an error.

Figure A-2 shows the processing flow of a batch CDR file in a node chain that contains two nodes:

  1. CDR CC node, which is responsible for processing input files received from the input directory.

  2. Node B, which if no errors are detected, receives the input stream from the CDR CC node.

Figure A-2 Batch CDR File Error Detection Flow

Description of Figure A-2 follows
Description of "Figure A-2 Batch CDR File Error Detection Flow"

In the node chain you configure the NPL with a flag value that outputs the CDR to one of the following:

  • If no suspended batch CDR file information exists, the CDR CC node moves the batch CDR file to an error directory and makes information on the suspended batch CDR file available for the Suspense DC node. The Suspense DC node changes the status to a suspended state and generates a Create file for SB Loader.

  • If the batch CDR file is valid, data processing continues to Node B.

  • If suspended batch CDR file information exists, the Suspense DC node changes the status to a succeeded state and generates an Update file for SB Loader.

Table A-2 describes the NPL configuration for the nodes in the node chain.

Table A-2 NPL Configuration

NPL Description
JavaHook suspHandler=oracle.communications.brm.nm.nplhook.SuspenseMethodHandlerImpl;

Java hook declaration.

InputRec { 
  String sourceFileName;
  Byte rejected;
  Byte resubmitted;
} in;

Input stream from the input directory.

Note: Not all the fields in the input stream are declared.

OutputRec {
  Integer pSUSPENDED;
} out;

Declares the routing Flag.

Note: Not all the fields in the output stream are declared.

Expose for Routing {
  out.pSUSPENDED "susp";
}

Expose the routing flag and set the display name.

/// local variables
String pipelineName;
String pipelineCategory;
String sourceDir;
String errorDir;
String sourcePrefix;
String sourceSuffix;
String targetPrefix;
String targetSuffix;
Integer count;
  
pipelineName="CDR Pipeline";
pipelineCategory="Wireless";
sourceDir="/input";
errorDir="batch/error";
sourcePrefix="test_";sourceSuffix="edr";
targetPrefix="err_";targetSuffix="bad";

Declare and initialize local variables.

// initialize routing flag to 0
out.pSUSPENDED=0;

Initialize the routing flag to 0.

if (in.rejected > 0) {
  // file was rejected
  logInfo("in rejected");
  // 1) move files from input directory to error
        directory
  count=SuspHandler.move(sourceDir, sourcePrefix,
              sourceSuffix, errorDir, targetPrefix,
              targetSuffix);
  // 2) create batch nar
  SuspHandler.assemble(out,
             sourcePrefix+in.sourceFileName+sourceSuffix,
             pipelineName,
             127,
             errorDir,
             targetPrefix+in.sourceFileName+targetSuffix,
             "Acme Wireless",
             "control10001",
             "01",
             "tap processing info",
             pipelineCategory);

If the batch CDR file is invalid, move the batch CDR file to an reject directory and call the assemble Java hook method to add the suspended batch file information to the output stream.

  // 3) set suspended flag
  out.pSUSPENDED=2;

Sets the suspended Flag to 2.

} else {
  // file is good, output input stream, and set flag
  logInfo("in good");
  out=clone(in);

If the input file is valid, prepare the output stream based on the input stream.

  // if this file was previously suspended
     (from resubmit/recycle),
  // 1) add suspense fields to output stream
  // 2) set suspended routing flag
  if (in.resubmitted > 0) {

If the input file is valid and was previously suspended, append the suspense fields to the output stream.

  // send 0 error code to flag success
  SuspHandler.assemble(out,
            sourcePrefix+in.sourceFileName+sourceSuffix,
            pipelineName,
            0);
            out.pSUSPENDED=1;
  }

Set the suspended flag to 1.

 }
write(out);

Writes out the stream.