Java Vuser Script

hi,

we have written a script for sending the message to MQ after some time the loadrunner scripts push more message than what its actaully need to push.

Loadrunner version 12.02

attached the script for your reference. can any one suggest what could be root cause of this issue.

 

 

  • /*
    * LoadRunner Java script. (Build: _build_number_)
    *
    * Script Description:
    *
    */

    import lrapi.lr;
    import lrapi.lr2;
    import com.ibm.mq.*;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Random;
    import java.lang.Integer;
    import java.util.Random;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.io.PrintWriter;
    import java.util.Calendar;
    import java.util.Properties;
    import java.text.SimpleDateFormat;
    import java.text.DecimalFormat;
    import java.util.Date;
    import java.util.ArrayList;
    import org.apache.commons.lang.RandomStringUtils;

    public class Actions
    {

    InputStream input = null;
    String queueMgrName = null;
    String putQueueName = null;
    String getQueueName = null;
    MQQueueManager queueMgr = null;
    MQQueue getQueue = null;
    MQQueue putQueue = null;
    MQQueue putQueue1 = null;
    MQPutMessageOptions pmo = new MQPutMessageOptions();
    MQMessage requestMsg =null;
    MQMessage responseMsg=null ;
    int mailPieceIdCount=0;
    int totalMailPieceIdCount=0;
    int messagesPerSceond = 0;
    double duration = 1;
    public Properties runRefProps = new Properties();
    String trigDateTime;
    String scndDatetime;
    String macStr = "";
    String manStr = "";
    ArrayList<String> machineMailpieceIds = new ArrayList<String>();
    ArrayList<String> manualMailpieceIds = new ArrayList<String>();
    ArrayList<String> allEventCodes = new ArrayList<String>();
    int accNum = 0;
    int accountsLoopCount = 0;
    String llllllEventCode=null;
    String YYYYYEventCode=null;
    String cccccEventCode=null;
    String ppppEventCode=null;
    String ddddddEventCode=null;
    String VuserIdA = "AA";
    String VuserIdM = "MM";
    int TT=300;

    public int init() throws Throwable {
    try
    {
    // As values set in the MQEnvironment class take effect when the
    // MQQueueManager constructor is called, you must set the values
    // in the MQEnvironment class before you construct an MQQueueManager object.
    //System.getProperty("user.dir")
    input = new FileInputStream("D:\\EPS_PVT\\Scripts\\Final\\BusinessGoLive2_2\\Scans.properties");
    runRefProps.load(input);
    queueMgrName = runRefProps.getProperty("queueMgrName");
    putQueueName = runRefProps.getProperty("putQueueName_STD");
    getQueueName = runRefProps.getProperty("getQueueName");
    MQEnvironment.hostname=runRefProps.getProperty("hostname");
    MQEnvironment.port=1414;
    MQEnvironment.channel =lr.eval_string("{ChannelID}");
    MQEnvironment.userID = runRefProps.getProperty("userID");
    queueMgr = new MQQueueManager(queueMgrName);
    // Access the put/get queues. Note the open options used.
    putQueue = queueMgr.accessQueue(putQueueName, MQC.MQOO_BIND_NOT_FIXED | MQC.MQOO_OUTPUT);
    putQueue1 = queueMgr.accessQueue(putQueueName, MQC.MQOO_BIND_NOT_FIXED | MQC.MQOO_OUTPUT);
    getQueue = queueMgr.accessQueue(getQueueName, MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT);
    }
    catch(Exception e) {
    lr.error_message("Error connecting to queue manager or accessing queues.");
    lr.error_message("Error sending message." e);
    lr.exit(lr.EXIT_VUSER, lr.FAIL);
    }
    return 0;
    }//end of init


    public int action() throws Throwable
    {
    //System.out.println("Vuser Id IS From Controller : " lr.get_vuser_id());
    if(lr.get_vuser_id() == 1){ VuserIdA = "LA"; VuserIdM = "LB";}
    if(lr.get_vuser_id() == 2){ VuserIdA = "LC"; VuserIdM = "LD";}
    if(lr.get_vuser_id() == 3){ VuserIdA = "LE"; VuserIdM = "LF";}
    if(lr.get_vuser_id() == 4){ VuserIdA = "LG"; VuserIdM = "LH";}
    if(lr.get_vuser_id() == 5){ VuserIdA = "LI"; VuserIdM = "LJ";}
    if(lr.get_vuser_id() == 6){ VuserIdA = "LK"; VuserIdM = "LL";}
    if(lr.get_vuser_id() == 7){ VuserIdA = "LM"; VuserIdM = "LN";}
    if(lr.get_vuser_id() == 8){ VuserIdA = "LO"; VuserIdM = "LP";}
    if(lr.get_vuser_id() == 9){ VuserIdA = "LQ"; VuserIdM = "LR";}
    if(lr.get_vuser_id() == 10){VuserIdA = "LS"; VuserIdM = "LT";}
    if(lr.get_vuser_id() == 11){VuserIdA = "LU"; VuserIdM = "LV";}
    if(lr.get_vuser_id() == 12){VuserIdA = "LW"; VuserIdM = "LX";}
    if(lr.get_vuser_id() == 13){VuserIdA = "LY"; VuserIdM = "LZ";}
    if(lr.get_vuser_id() == 14){VuserIdA = "NA"; VuserIdM = "NB";}
    if(lr.get_vuser_id() == 15){VuserIdA = "NC"; VuserIdM = "ND";}
    if(lr.get_vuser_id() == 16){VuserIdA = "NE"; VuserIdM = "NF";}
    if(lr.get_vuser_id() == 17){VuserIdA = "NG"; VuserIdM = "NH";}
    if(lr.get_vuser_id() == 18){VuserIdA = "NI"; VuserIdM = "NJ";}
    if(lr.get_vuser_id() == 19){VuserIdA = "NK"; VuserIdM = "NL";}
    if(lr.get_vuser_id() == 20){VuserIdA = "NM"; VuserIdM = "NN";}
    requestMsg = new MQMessage();
    responseMsg = new MQMessage();
    responseMsg.clearMessage();
    accNum=Integer.parseInt(runRefProps.getProperty("AccountNumber_2D"));
    messagesPerSceond = Integer.parseInt(runRefProps.getProperty("MessagesPerSceond_2D"));
    accountsLoopCount = Integer.parseInt(runRefProps.getProperty("AccountsLoopCount_2D"));
    llllllEventCode=runRefProps.getProperty("llllllEventCode");
    YYYYYEventCode=runRefProps.getProperty("YYYYYEventCode");
    cccccEventCode=runRefProps.getProperty("cccccEventCode");
    ppppEventCode=runRefProps.getProperty("ppppEventCode");
    ddddddEventCode=runRefProps.getProperty("ddddddEventCode");
    allEventCodes.add(YYYYYEventCode);
    allEventCodes.add(cccccEventCode);
    allEventCodes.add(ppppEventCode);
    allEventCodes.add(ddddddEventCode);
    totalMailPieceIdCount = 0;
    lr.start_transaction("Scans_2D");
    System.out.println(new SimpleDateFormat ("yyyy-MM-dd'T'hh:mm:ss.S'Z'").format(new Date()));
    try
    {
    requestMsg.replyToQueueName = getQueueName; // the response should be put on this queue
    requestMsg.report=MQC.MQRO_PASS_MSG_ID; //If a report or reply is generated as a result of this message, the MsgId of this message is copied to the MsgId of the report or reply message.
    requestMsg.format = MQC.MQFMT_STRING; // Set message format. The application message data can be either an SBCS string (single-byte character set), or a DBCS string (double-byte character set).
    requestMsg.messageType=MQC.MQMT_REQUEST; // The message is one that requires a reply.
    pmo.options = MQC.MQPMO_NEW_MSG_ID; // The queue manager replaces the contents of the MsgId field in MQMD with a new message identifier.
    InvokeCreateScans();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    return 0;
    }//end of action

    public void InvokeCreateScans() throws Throwable
    {
    try
    {

    for (int chnnIndex=1;chnnIndex<=4;chnnIndex )
    {
    String channelid=null;
    int barcodelength=0;
    String mailPieceID=null;
    if(chnnIndex==1){
    channelid="09";
    barcodelength=19;
    }
    else if(chnnIndex==2){
    channelid="0B";
    barcodelength=19;
    }
    else if(chnnIndex==3){
    channelid="02";
    barcodelength=14;
    }
    else if(chnnIndex==4){
    channelid="04";
    barcodelength=9;
    }
    for(int i=1;i<=accountsLoopCount;i )
    {
    //System.currentTimeMillis()
    //String timeinMilliSecString = Long.toString(System.currentTimeMillis() i);
    String timeinMilliSecString = RandomStringUtils.randomAlphabetic(20);
    accNum = accNum 1;
    //MailPiece ID Generation for DMO and COSS
    if(channelid=="09" || channelid=="0B"){
    mailPieceID=channelid "0" Integer.toString(accNum) timeinMilliSecString.substring((timeinMilliSecString.length() 12)-barcodelength, timeinMilliSecString.length());
    }
    //MailPiece ID Generation for OLP and OLP
    if(channelid=="02" || channelid=="04"){
    mailPieceID=channelid timeinMilliSecString.substring((timeinMilliSecString.length() 2)-barcodelength, timeinMilliSecString.length());
    }
    requestMsg.clearMessage();

    lr.start_transaction("Scan2D_Mac_llllll");

    createMachineScan(mailPieceID VuserIdA , llllllEventCode); // message payload

    lr.end_transaction("Scan2D_Mac_llllll", lr.AUTO);

    machineMailpieceIds.add(mailPieceID VuserIdA);
    requestMsg.clearMessage();

    lr.start_transaction("Scan2D_Man_llllll");
    createManualScan(mailPieceID VuserIdM , llllllEventCode); // message payload

    lr.end_transaction("Scan2D_Man_llllll", lr.AUTO);

    manualMailpieceIds.add(mailPieceID VuserIdM);
    //lr.log_message(mailPieceID VuserIdA);
    //lr.log_message(mailPieceID VuserIdM);
    }
    //accNum=Integer.parseInt(runRefProps.getProperty("AccountNumber"));
    }


    lr.think_time(TT);
    String YYYYYEventCodelist = YYYYYEventCodeProcess(machineMailpieceIds, manualMailpieceIds, YYYYYEventCode);
    lr.think_time(TT);
    String cccccEventCodelist = cccccEventCodeProcess(machineMailpieceIds, manualMailpieceIds, cccccEventCode);
    lr.think_time(TT);
    String ppppEventCodelist = ppppEventCodeProcess(machineMailpieceIds, manualMailpieceIds, ppppEventCode);
    lr.think_time(TT);
    String ddddddEventCodelist = ddddddEventCodeProcess(machineMailpieceIds, manualMailpieceIds, ddddddEventCode);
    lr.think_time(TT);

    }
    catch(Exception e)
    {
    e.printStackTrace();
    lr.error_message("Error connecting to queue manager or accessing queues.");
    lr.error_message("Error during event processing ." e);
    lr.exit(lr.EXIT_VUSER, lr.FAIL);
    }

    duration =1;
    // lr.log_message("machineMailpieceIds : " machineMailpieceIds.size());
    // lr.log_message("manualMailpieceIds : " manualMailpieceIds.size());
    machineMailpieceIds.clear();
    manualMailpieceIds.clear();
    allEventCodes.clear();
    lr.log_message("mailPieceIdCount : " totalMailPieceIdCount);
    lr.end_transaction("Scans_2D",lr.PASS);
    }


    public int end() throws Throwable {
    //Close all the connections
    try
    {
    putQueue.close();
    putQueue1.close();
    getQueue.close();
    queueMgr.close();
    input.close();
    }
    catch(Exception e)
    {
    lr.error_message("Exception in closing the connections");
    lr.exit(lr.EXIT_VUSER, lr.FAIL);
    }
    return 0;
    }//end of end

    public String createMachineScan(String barCodeID,String eventCode) throws Throwable
    {
    trigDateTime = new SimpleDateFormat ("yyyy-MM-dd'T'hh:mm:ss.S'Z'").format(new Date());

    macStr = "<?xml version=\"1.0\"" " encoding=\"UTF-8\" standalone=\"yes\"?> <ptp:MPE xsi:schemaLocation=\"http://www.xxxxgroup.com/cm/ptpMailPiece/V1 ptpMailPiece.xsd\" xmlns:ptp=\"http://www.xxxxgroup.com/cm/ptpMailPiece/V1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> <mailPiece><mailPieceBarcode><xxxxSegment><UPUCountry>UPUC</UPUCountry><informationCode>C</informationCode><versionId>V</versionId>"
    "<mailItemFormatCode>12</mailItemFormatCode><mailClassCode>1</mailClassCode><mailTypeCode>1</mailTypeCode></xxxxSegment><channelSegment>"
    "<uniqueItemId>" barCodeID "</uniqueItemId><mailPieceWeight>1</mailPieceWeight><weightCode>1</weightCode><pricePaid>1</pricePaid><barcodeCreationDate>2015-07-21</barcodeCreationDate>"
    "<productId>RM6</productId><mailPieceCode>1</mailPieceCode>"
    "<UPUTrackingNumber/><address><buildingName>buildingName</buildingName><buildingNumber>1</buildingNumber></address><destinationPostcodeDPS><postcode>PC_001</postcode><postcodeSuffix>01</postcodeSuffix></destinationPostcodeDPS><destinationCountry>CON</destinationCountry><returnToSenderPostcode><postcode>PC_001</postcode><postcodeSuffix>01</postcodeSuffix></returnToSenderPostcode><requiredAtDeliveryCode>1</requiredAtDeliveryCode></channelSegment><POLBranchId>POL_01</POLBranchId><channelBusinessSegment><despatchPostCode><postcode>PC_001</postcode><postcodeSuffix>01</postcodeSuffix></despatchPostCode><customerReferenceComment>customerReferenc</customerReferenceComment></channelBusinessSegment><channelEIBSegment><itemId>0112345</itemId><dieId>dieId</dieId><supplyChainId>SCID</supplyChainId><licenceId>LIC01</licenceId><productGroupCode>01</productGroupCode><tariffVersion>V</tariffVersion><tariffRate>R</tariffRate><mailingDate>2015-07-21</mailingDate>"
    "<channelCode>AS</channelCode><businessReplyPostcodeDPS><postcode>PC_001</postcode><postcodeSuffix>01</postcodeSuffix></businessReplyPostcodeDPS><securitySegment><hashEncoding>hashEncoding</hashEncoding><keyId>K</keyId></securitySegment><returnToSenderCode>C</returnToSenderCode><customerReferenceComment>customerReferenComment</customerReferenceComment><format>F</format></channelEIBSegment><PFWWBarcode><postcodeDomestic><outward>out</outward><inward>inw</inward></postcodeDomestic><BFPOOnestop>BFPOOnestop</BFPOOnestop><BFPOMOD>BFPOMOD</BFPOMOD><internationalUPI>partnerUPI</internationalUPI></PFWWBarcode><GLSBarcode><primaryBarcode>primaryBarcode</primaryBarcode><secondaryBarcode>secondaryBarcode</secondaryBarcode></GLSBarcode><internationalRegisteredBarcode>IRBarcode</internationalRegisteredBarcode>"
    "<oneD><oneDBarcode/><highVolumePostcode>highVol</highVolumePostcode></oneD><ANSIGrade>A</ANSIGrade><returnsCustomerId>CustomerId</returnsCustomerId></mailPieceBarcode><dims><length><UYYYYYode>cm</UYYYYYode><value>50</value></length><height><UYYYYYode>cm</UYYYYYode><value>40</value></height><width><UYYYYYode>cm</UYYYYYode><value>30</value></width><weight>60</weight><lengthLFT><UYYYYYode>UoM</UYYYYYode><value>10</value></lengthLFT><heightLFT><UYYYYYode>UoM</UYYYYYode><value>10</value></heightLFT><widthLFT><UYYYYYode>UoM</UYYYYYode><value>10</value></widthLFT><weightLFT>30</weightLFT><img><imageUrl>imageUrlImageUrl</imageUrl><perspective>6</perspective></img></dims><postageDue>0</postageDue><trueVolume>12.0</trueVolume></mailPiece><machineRecord><runtimeMachineParameters><machineId>101</machineId><RMGLocation><functionalLocationId>1</functionalLocationId><siteId>011111</siteId></RMGLocation></runtimeMachineParameters><controlSystem><PSMMailPieceId>11</PSMMailPieceId><feedingTimestamp>2015-07-21T14:20:00-05:00</feedingTimestamp>"
    "<sortToOutputTimestamp>" trigDateTime "</sortToOutputTimestamp><tariffCode>1</tariffCode><DSAMissortIndicator>1</DSAMissortIndicator><rejectReason>1</rejectReason><infeedId>1</infeedId><inductId>1</inductId><tunnelId>1</tunnelId><intendedOutputId>1</intendedOutputId><actualOutputId>1</actualOutputId><mailPieceRecirculationCount>0</mailPieceRecirculationCount><mailPieceRecirculationLimit>0</mailPieceRecirculationLimit><infeedStatusList>infeedStatusList</infeedStatusList><inductStatusList>inductStatusList</inductStatusList><tunnelStatusList>tunnelStatusList</tunnelStatusList><PSAStatus>1</PSAStatus><outputsDisabledStatusList>outputsDisabledStatusList</outputsDisabledStatusList><mailPieceOOSIndicator>1</mailPieceOOSIndicator><revenueProtectionStatus>0</revenueProtectionStatus>"
    "<trackedEventCode>" eventCode "</trackedEventCode><chuteId>CID_000000001</chuteId><rejectIndicator>1</rejectIndicator><trackedIndicator>1</trackedIndicator></controlSystem><SP><SPDescription>SPDescription</SPDescription><SPId>544</SPId><sortOutcomeCode>101</sortOutcomeCode><sortSelectionDestinationCode>101123</sortSelectionDestinationCode><processingFunctionCode>1</processingFunctionCode></SP><operationalMailstream><infeedOperationalMailstream>infeedOperationalMailstream</infeedOperationalMailstream><IYYYYYode>8</IYYYYYode></operationalMailstream><SPIDData><postcode>PC_001</postcode><mailClassCode>1</mailClassCode><revenueProtectionStatus>0</revenueProtectionStatus><DSAMissortIndicator>1</DSAMissortIndicator><ruleSet5>ruleSet5</ruleSet5><ruleSet6>1</ruleSet6></SPIDData><SPConfiguration><deliveredBy>101101</deliveredBy></SPConfiguration>"
    "</machineRecord></ptp:MPE>";

    //lr.think_time(10);
    //lr.log_message("Machine Scan: " eventCode ": " barCodeID);
    requestMsg.clearMessage();
    requestMsg.writeString(macStr); // message payload
    putQueue.put(requestMsg, pmo);
    mailPieceIdCount ;
    if(mailPieceIdCount == messagesPerSceond && lr.get_transaction_duration("Scans_2D") <= duration){
    double durationCheck = duration - lr.get_transaction_duration("Scans_2D");
    durationCheck = durationCheck * 1000;
    //lr.log_message("wait durationCheck 1: " lr.get_transaction_duration("Scans_2D"));
    //lr.log_message("wait durationCheck 2: " duration);
    //lr.log_message("wait durationCheck 3: " durationCheck);
    int x = (int)(durationCheck);
    Thread.sleep(x);
    lr.log_message("mailPieceIdCount 8: " mailPieceIdCount);
    mailPieceIdCount =0;
    duration = duration 1;
    }
    totalMailPieceIdCount ;
    return macStr;
    }

    public String createManualScan(String barCodeID,String eventCode) throws Throwable
    {
    scndDatetime = new SimpleDateFormat ("yyyy-MM-dd'T'hh:mm:ss.S'Z'").format(new Date());
    manStr = "<?xml version=\"1.0\"" " encoding=\"UTF-8\" standalone=\"yes\"?> "
    "<ptp:MPE xsi:schemaLocation=\"http://www.xxxxgroup.com/cm/ptpMailPiece/V1 ptpMailPiece.xsd\" xmlns:ptp=\"http://www.xxxxgroup.com/cm/ptpMailPiece/V1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
    "<mailPiece><mailPieceBarcode><xxxxSegment><UPUCountry>UPUC</UPUCountry><informationCode>C</informationCode>"
    "<versionId>V</versionId><mailItemFormatCode>12</mailItemFormatCode><mailClassCode>1</mailClassCode><mailTypeCode>1</mailTypeCode>"
    "</xxxxSegment><channelSegment><uniqueItemId>" barCodeID "</uniqueItemId><mailPieceWeight>1</mailPieceWeight><weightCode>1</weightCode>"
    "<pricePaid>1</pricePaid><barcodeCreationDate>2015-05-26</barcodeCreationDate><productId>RM6</productId><mailPieceCode>1</mailPieceCode>"
    "<UPUTrackingNumber/><address><buildingName>buildingName</buildingName><buildingNumber>1</buildingNumber>"
    "</address><destinationPostcodeDPS><postcode>PC_001</postcode><postcodeSuffix>01</postcodeSuffix></destinationPostcodeDPS>"
    "<destinationCountry>CON</destinationCountry><returnToSenderPostcode><postcode>PC_001</postcode><postcodeSuffix>01</postcodeSuffix></returnToSenderPostcode>"
    "<requiredAtDeliveryCode>1</requiredAtDeliveryCode></channelSegment><POLBranchId>POL_01</POLBranchId><channelBusinessSegment><despatchPostCode>"
    "<postcode>PC_001</postcode><postcodeSuffix>01</postcodeSuffix></despatchPostCode><customerReferenceComment>customerReferenc</customerReferenceComment>"
    "</channelBusinessSegment><channelEIBSegment><itemId>0123456</itemId><dieId>dieId</dieId><supplyChainId>SP_CID</supplyChainId><licenceId>LIC01</licenceId>"
    "<productGroupCode>121</productGroupCode><tariffVersion>V</tariffVersion><tariffRate>R</tariffRate><mailingDate>2015-05-26</mailingDate>"
    "<channelCode>MS</channelCode><businessReplyPostcodeDPS><postcode>PC_001</postcode><postcodeSuffix>01</postcodeSuffix></businessReplyPostcodeDPS>"
    "<securitySegment><hashEncoding>hashEncoding</hashEncoding><keyId>K</keyId></securitySegment><returnToSenderCode>C</returnToSenderCode>"
    "<customerReferenceComment>customerReferenComment</customerReferenceComment><format>F</format></channelEIBSegment><PFWWBarcode>"
    "<postcodeDomestic><outward>Out1</outward><inward>In1</inward></postcodeDomestic><BFPOOnestop>BFPOOnestop</BFPOOnestop><BFPOMOD>BFPOMOD</BFPOMOD>"
    "<internationalUPI>partnerUPI</internationalUPI></PFWWBarcode><GLSBarcode><primaryBarcode>primaryBarcode</primaryBarcode><secondaryBarcode>secondaryBarcode</secondaryBarcode></GLSBarcode>"
    "<internationalRegisteredBarcode>intRegBar_001</internationalRegisteredBarcode><oneD><oneDBarcode/><highVolumePostcode>highVol</highVolumePostcode></oneD>"
    "<ANSIGrade>A</ANSIGrade><returnsCustomerId>CustomerId</returnsCustomerId></mailPieceBarcode><dims><length><UYYYYYode>cm</UYYYYYode><value>50</value></length><height>"
    "<UYYYYYode>cm</UYYYYYode><value>40</value></height><width><UYYYYYode>cm</UYYYYYode><value>30</value></width><weight>60</weight><lengthLFT><UYYYYYode>UoM</UYYYYYode><value>10</value></lengthLFT><heightLFT>"
    "<UYYYYYode>UoM</UYYYYYode><value>10</value></heightLFT><widthLFT><UYYYYYode>UoM</UYYYYYode><value>10</value></widthLFT><weightLFT>30</weightLFT><img><imageUrl>imageUrlImageUrl</imageUrl><perspective>6</perspective></img>"
    "</dims><postageDue>0</postageDue><trueVolume>12.0</trueVolume></mailPiece><manualScan><routeOrWalkNumber>routeReq</routeOrWalkNumber>"
    "<messageId>" RandomStringUtils.randomAlphabetic(20) "</messageId><trackEventId>" RandomStringUtils.randomAlphabetic(20) "</trackEventId><deviceId>088</deviceId><userId>userId</userId>"
    "<RMGLocation><siteId>018678</siteId></RMGLocation><scanLocation><gdsCode>WGS84</gdsCode><positionCode>PostionCode</positionCode>"
    "<altitude>1.0</altitude><longitude>20.0</longitude><latitude>10.0</latitude></scanLocation> <trackedEventCode>" eventCode "</trackedEventCode>"
    "<scanTimestamp>" scndDatetime "</scanTimestamp><scanComment>scanComment</scanComment><eventTimestamp>" scndDatetime "</eventTimestamp><transmissionTimestamp>" scndDatetime "</transmissionTimestamp>"
    "<transmissionCompleteTimestamp>" scndDatetime "</transmissionCompleteTimestamp><eventReceivedTimestamp>" scndDatetime "</eventReceivedTimestamp><eventReason>11</eventReason>"
    "<manualScanIndicator>0</manualScanIndicator><workProcessCode>123456</workProcessCode><neighbourName>neighbourName</neighbourName><neighbourAddress><addressUsageCode>addressUsageCode</addressUsageCode>"
    "<domesticIndicator>1</domesticIndicator><buildingName>buildingName</buildingName><buildingNumber>2</buildingNumber><addressLine1>addressLine1</addressLine1><addressLine2>addressLine2</addressLine2>"
    "<addressLine3>addressLine3</addressLine3><addressLine4>addressLine4</addressLine4><addressLine5>addressLine5</addressLine5><stateOrProvince>stateOrProvince</stateOrProvince><postTown>postTown</postTown>"
    "<county>county</county><postcode>postcode</postcode><country>country</country></neighbourAddress><safePlaceLocation><gdsCode>geoDeticSystem</gdsCode><positionCode>positionCode</positionCode><altitude>12.0</altitude>"
    "<longitude>12.0</longitude><latitude>12.0</latitude></safePlaceLocation><signatureName>signatureName</signatureName><signatureImage>AA==</signatureImage><signatureSVG><svg><polyline style=\"fill:none; stroke:#000000; stroke-width:1\" points=\"64,88 65,89 \"/"
    "></svg></signatureSVG></manualScan></ptp:MPE>";

    //lr.think_time(10);
    // lr.log_message("Manual Scan: " eventCode ": " barCodeID);
    requestMsg.clearMessage();
    requestMsg.writeString(manStr); // message payload
    putQueue1.put(requestMsg, pmo);
    mailPieceIdCount ;
    if(mailPieceIdCount == messagesPerSceond && lr.get_transaction_duration("Scans_2D") <= duration){
    double durationCheck = duration - lr.get_transaction_duration("Scans_2D");
    durationCheck = durationCheck * 1000;
    //lr.log_message("wait durationCheck 4: " lr.get_transaction_duration("Scans_2D"));
    //lr.log_message("wait durationCheck 5: " duration);
    //lr.log_message("wait durationCheck 6: " durationCheck);
    int x = (int)(durationCheck);
    Thread.sleep(x);
    lr.log_message("mailPieceIdCount 7: " mailPieceIdCount);
    mailPieceIdCount =0;
    duration = duration 1;
    }
    totalMailPieceIdCount ;
    return manStr;
    }

    public String YYYYYEventCodeProcess(ArrayList machineMailpieceIds, ArrayList manualMailpieceIds, String eventCode) throws Throwable
    {
    for(int i=0;i<machineMailpieceIds.size();i ){

    lr.start_transaction("Scan2D_Mac_YYYYY");
    createMachineScan(machineMailpieceIds.get(i).toString() , eventCode); // message payload

    lr.end_transaction("Scan2D_Mac_YYYYY", lr.AUTO);

    //lr.think_time(TT);
    }

    //lr.think_time(TT);

    for(int j=0;j<manualMailpieceIds.size();j ){

    lr.start_transaction("Scan2D_Man_YYYYY");

    createManualScan(manualMailpieceIds.get(j).toString() , eventCode); // message payload

    lr.end_transaction("Scan2D_Man_YYYYY", lr.AUTO);

    //lr.think_time(TT);
    }
    return "true";
    }

    public String cccccEventCodeProcess(ArrayList machineMailpieceIds, ArrayList manualMailpieceIds, String eventCode) throws Throwable
    {
    for(int i=0;i<machineMailpieceIds.size();i ){

    lr.start_transaction("Scan2D_Mac_ccccc");
    createMachineScan(machineMailpieceIds.get(i).toString() , eventCode); // message payload
    lr.end_transaction("Scan2D_Mac_ccccc", lr.AUTO);

    //lr.think_time(TT);
    }

    //lr.think_time(TT);

    for(int j=0;j<manualMailpieceIds.size();j ){

    lr.start_transaction("Scan2D_Man_ccccc");
    createManualScan(manualMailpieceIds.get(j).toString() , eventCode); // message payload
    lr.end_transaction("Scan2D_Man_ccccc", lr.AUTO);

    //lr.think_time(TT);
    }
    return "true";
    }

    public String ppppEventCodeProcess(ArrayList machineMailpieceIds, ArrayList manualMailpieceIds, String eventCode) throws Throwable
    {
    for(int i=0;i<machineMailpieceIds.size();i ){

    lr.start_transaction("Scan2D_Mac_pppp");
    createMachineScan(machineMailpieceIds.get(i).toString() , eventCode); // message payload
    lr.end_transaction("Scan2D_Mac_pppp", lr.AUTO);

    //lr.think_time(TT);
    }

    //lr.think_time(TT);

    for(int j=0;j<manualMailpieceIds.size();j ){

    lr.start_transaction("Scan2D_Man_pppp");
    createManualScan(manualMailpieceIds.get(j).toString() , eventCode); // message payload

    lr.end_transaction("Scan2D_Man_pppp", lr.AUTO);

    //lr.think_time(TT);
    }
    return "true";
    }

    public String ddddddEventCodeProcess(ArrayList machineMailpieceIds, ArrayList manualMailpieceIds, String eventCode) throws Throwable
    {
    for(int i=0;i<machineMailpieceIds.size();i ){

    lr.start_transaction("Scan2D_Mac_Door");
    createMachineScan(machineMailpieceIds.get(i).toString() , eventCode); // message payload
    lr.end_transaction("Scan2D_Mac_Door", lr.AUTO);
    //lr.think_time(TT);
    }

    //lr.think_time(TT);

    for(int j=0;j<manualMailpieceIds.size();j ){

    lr.start_transaction("Scan2D_Man_Door");
    createManualScan(manualMailpieceIds.get(j).toString() , eventCode); // message payload
    lr.end_transaction("Scan2D_Man_Door", lr.AUTO);


    }
    return "true";
    }
    }