> For the complete documentation index, see [llms.txt](https://docs.xplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xplatform.com/talon/developing-applications/configuring-the-runtime/message-flow/duplicate-detection.md).

# Duplicate Detection

This page describes how to configure duplicate detection for inbound messages. For conceptual information about how duplicate detection works, see [Detecting Duplicates](/talon/developing-applications/authoring-user-code/message-processing/detecting-duplicates.md).

## Configuration

Duplicate detection is controlled by the `performDuplicateChecking` configuration parameter on the microservice:

```xml
<app name="order-processor" mainClass="com.example.OrderProcessor">
  <messaging>
    <!-- messaging config -->
  </messaging>

  <!-- Enable duplicate detection (default: true) -->
  <performDuplicateChecking>true</performDuplicateChecking>
</app>
```

### Default Behavior

By default, `performDuplicateChecking` is set to `true`, meaning duplicate detection is enabled. When enabled:

* The AEP Engine tracks sequence numbers for each bus+channel+qos combination
* Messages with sequence numbers ≤ previously received sequence numbers are discarded
* Duplicate messages are **not** dispatched to application handlers
* The `NumDupMsgsRcvd` statistic is incremented for each duplicate detected

## Disabling Duplicate Detection

You may want to disable duplicate detection if:

* Your application is **tolerant of duplicates** and has its own duplicate detection logic
* Your application performs **idempotent operations** where processing the same message multiple times has no adverse effects
* You want to implement **custom duplicate detection** using application-specific business keys rather than sequence numbers

To disable duplicate detection:

```xml
<app name="order-processor" mainClass="com.example.OrderProcessor">
  <messaging>
    <!-- messaging config -->
  </messaging>

  <!-- Disable duplicate detection -->
  <performDuplicateChecking>false</performDuplicateChecking>
</app>
```

{% hint style="warning" %}
Disabling duplicate detection means your application handlers will receive duplicate messages if the underlying message bus delivers them. Ensure your application logic can handle this correctly.
{% endhint %}

## See Also

* [Detecting Duplicates](/talon/developing-applications/authoring-user-code/message-processing/detecting-duplicates.md) - Conceptual overview including prerequisites and monitoring
