Update Persister Configuration

Overview

Update persister configuration -

  • If you add, remove, or rename a field in the PGR request payload (service or address).

  • If you want new data to be saved to the database.

When is it required?

  • Field added/removed/renamed in the request payload (e.g., service, address).

  • New data needs to be persisted to the DB (e.g., a new column added).

  • The database schema is modified (e.g., table changes, new columns).

  • New nested objects/entities are introduced in the payload.

  • Audit logs or Elasticsearch indexing is added via Persister.

⚠️ What if not updated?

  • Data won’t be saved.

  • DB errors may occur.

  • UI or search APIs may break due to missing data.

💡 Always ensure JSONPaths in persister.yaml match your latest payload and DB structure.

Configuration File

  • File: egov-persister/pgr-services-persister.yml

  • This file maps fields from Kafka topics (like save-pgr-request) to DB tables (like eg_pgr_service_v2).

Steps

1

Create/Insert New/Changed Fields

  • Find the section: fromTopic: save-pgr-request

  • In the relevant INSERT query (e.g., for eg_pgr_service_v2):

    • Add your new column to the SQL (e.g., priority=?)

    • Add a jsonPath mapping to the new field (e.g., - jsonPath: $.service.priority)

  • Example:

    - query: INSERT INTO eg_pgr_service_v2(..., priority) VALUES (..., ?);
      ...
      jsonMaps:
        ...
        - jsonPath: $.service.priority
2

Update New/Changed Fields

  • Find the section: fromTopic: update-pgr-request

  • In the UPDATE query (for either service or address):

    • Add your new column (e.g., priority=?)

    • Add a jsonPath for the field (e.g., - jsonPath: $.service.priority)

Tip: If the field is in address, use the right table and path (e.g., $.service.address.priority).

3

Restart the Persister Service

  • After saving and committing the YAML, restart the egov-persister service.

  • Why? The service only reads the YAML at startup!

  • Kubernetes command:

    kubectl rollout restart deployment egov-persister

Summary - Checklist

Step
What To Do
Why

1️⃣ Update save-pgr-request

Map new fields for INSERT

For DB inserts

2️⃣ Update update-pgr-request

Map new fields for UPDATE

For DB updates

3️⃣ Restart persister

Reload updated YAML config

To apply changes

Last updated

Was this helpful?