Skip to content

qie.getMessageCount

Signature: qie.getMessageCount(startDate, endDate)

Returns: JSON Message messageCount - the count in a JSON message object

Returns a JSON message object containing the count for the date range defined by the startDate and endDate.

Note

When the date range spans more than one day the returned count is a sum for the range.

Note

When the date range contains today's date the count returns the counts written to the database. The write frequency is determined by the java option -Dqie.dailyMessageCountWriteFrequency (default=1500ms).

Note

The JSON message object has the following elements:   zoneName   channelName   channelId   startDate   endDate   receivedCount   destinationNodes

Note

The destination nodes in the array has the following elements:   destinationNodeId   index   title   completedCount   description   endpointId

Parameters

Type Name Description Default
String or Date startDate the start of the date range
String or Date endDate the end of the date range

Example

// Example: startDate as String, endDate as String
var jsonStats = qie.getMessageCount('2024-12-02', '2024-12-15'); // JSON Message
/* e.g. jsonStats.formatJSON(3)
{
   "zoneName": "Default Zone",
   "channelName": "JSON forever",
   "channelId": "ff80818195af159c0196ee3f0f0d017a",
   "startDate": "2024-12-02",
   "endDate": "2024-12-15",
   "receivedCount": 7422,
   "destinationNodes": [
      {
         "destinationNodeId": "ff80818195af159c0196ee3f0f0e017b",
         "index": 3,
         "title": "Discard",
         "completedCount": 7396,
         "description": "",
         "endpointId": ""
      }
   ]
}
*/
var receivedMessageCount = jsonStats.getNode("/receivedCount");

// Example: startDate as Date, endDate as Date
var startDate = qie.deduceDate('2024-12-02');
var endDate = qie.deduceDate('2024-12-15');
jsonStats = qie.getMessageCount(startDate, endDate); // JSON Message
receivedMessageCount = jsonStats.getNode("/receivedCount");

// Example: startDate as String, endDate as Date
endDate = qie.deduceDate('2024-12-15');
jsonStats = qie.getMessageCount('2024-12-02', endDate); // JSON Message
receivedMessageCount = jsonStats.getNode("/receivedCount");

// Example: startDate as Date, endDate as String
startDate = qie.deduceDate('2024-12-02');
jsonStats = qie.getMessageCount(startDate, '2024-12-15'); // JSON Message
receivedMessageCount = jsonStats.getNode("/receivedCount");