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 (likeeg_pgr_service_v2
).
Steps
Create/Insert New/Changed Fields
Find the section:
fromTopic: save-pgr-request
In the relevant
INSERT
query (e.g., foreg_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
Summary - Checklist
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?