---
title: Message Counter
slug: litmusedge/message-counter
docTags: 
createdAt: 2026-08-25T21:16:36.740Z
---

The Message Counter counts how many messages pass through it during an interval and emits a summary at the end of each interval. Use it to measure message throughput, such as the number of readings a device sends per minute.

## How it works

The processor counts every incoming message and emits a summary message when the interval ends. The **Mode** parameter sets what defines an interval.

## Modes

- `internal` uses a built-in timer to define the interval. Set the interval with **Timer Interval Value** and **Timer Interval Type**. Enable **Align To Clock** to align interval boundaries to the system clock, so a one-minute interval fires at `:00`, `:01`, and so on.
- `external` lets an input wire control the counter. Name the wire `measure` to emit a summary and reset the count, or name it `report` to emit a summary without resetting.

## Output fields

Each summary message contains the following fields:

- `count`: the number of messages received in the interval.
- `timestamp`: the time the summary was emitted, in milliseconds since epoch.
- `intervalStart`: the start of the counting interval, in milliseconds since epoch.

## Parameters

**Note:** The **Timer Interval Value**, **Timer Interval Type**, and **Align To Clock** settings apply only in `internal` mode. In `external` mode, the wire names `measure` and `report` control when the counter emits and resets.

| **Parameters**       | **Details**                                                                                  |
| -------------------- | -------------------------------------------------------------------------------------------- |
| Mode                 | The interval source: `internal` for the built-in timer, or `external` for control messages.  |
| Timer Interval Value | The interval duration, used in `internal` mode. Default is `1`.                              |
| Timer Interval Type  | The interval units, used in `internal` mode: seconds, minutes, or hours. Default is minutes. |
| Align To Clock       | Aligns ticks to clock boundaries, so a one-minute interval fires at `:00`, `:01`, and so on. |

