> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/works/reference-implementations/muktasoft-v2.2/deployment/sms-adapter-services/measurement-notification-service.md).

# Measurement Notification Service

* Package: org.egov.works.service
* Source File: MeasurementNotificationService.java

## Overview

The MeasurementNotificationService class is responsible for processing notifications related to measurements within the eGov Works module. It handles the generation and sending of notifications to relevant personnel based on different actions performed on measurements, such as approval or rejection.

## Attributes

1. mapper: ObjectMapper for JSON serialization/deserialization.
2. notificationServiceConfiguration: Configuration settings for notification services.
3. measurementServiceUtil: Utility class for measurement-related operations.
4. producer: Kafka producer for sending notifications.

## Methods

* process(final String record, @Header(KafkaHeaders.RECEIVED\_TOPIC) String topic): Processes the incoming Kafka message containing measurement details and delegates the notification sending process to the appropriate method.
* sendNotification(MeasurementServiceRequest request): Sends notifications to relevant personnel based on the action performed on the measurement (e.g., approval, rejection).
* setAdditionalFields(MeasurementServiceRequest request, String localizationCode, Map\<String, Object> additionalField): Sets additional fields for the notification if required.
* checkAdditionalFieldAndPushONSmsTopic(String customizedMessage, Map\<String, Object> additionalField, Map\<String, String> smsDetails): Checks if additional fields are present and sends the SMS request accordingly.
* getCustomMessage(String message, String measurementNumber, String projectNumber): Replaces variables in a message template with actual measurement and project numbers.
* getMessage(MeasurementServiceRequest request, String msgCode): Retrieves the localized message for a given code and locale.

## Usage

Instantiate and configure the MeasurementNotificationService class within the application context to handle notifications related to measurements. Ensure that dependencies such as ObjectMapper, configuration settings, and utility classes are properly injected.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/works/reference-implementations/muktasoft-v2.2/deployment/sms-adapter-services/measurement-notification-service.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
