Data flow¶
How does data flow between components?¶
sequenceDiagram
participant Src as Adopter JDBC source
participant Job as dsp-job-data-migration
participant JobGeo as dsp-job-geo-file-generation
participant DspDb as dsp-db
participant ExDb as geoserver-db
participant S3 as SeaweedFS (object storage)
participant GsEx as GeoServer Exhibition
participant GsDl as GeoServer Download
participant Be as dsp-backend
participant Fe as dsp-frontend
Job->>Src: Reads attributes + geometry (watermark filter)
Job->>DspDb: Writes business + bbox/centroid (UPSERT)
Job->>ExDb: Writes attributes + full geom (UPSERT)
Job->>DspDb: Metadata + watermark (data_migration schema)
Job->>ExDb: Reads geom (kpi-job)
Job->>DspDb: Updates area + kpi_measure (kpi-job)
GsEx->>ExDb: Publishes WMS/WFS layers (map)
GsDl->>ExDb: Publishes the same layers for WFS (downloads)
JobGeo->>ExDb: Reads geometry to build territorial CSV
JobGeo->>S3: Writes pre-generated CSV (S3 API)
JobGeo->>DspDb: Batch metadata (geo_file_generation schema)
Be->>DspDb: Reads business data (no full geometry)
Fe->>Be: GET /config/installation (KPI cards)
Fe->>Be: POST /totalizer/ (KPI values)
Fe->>Be: Consumes REST API (search, downloads)
Fe->>Be: POST /downloads/search and GET /downloads/file
alt Pre-generated CSV exists in bucket
Be->>S3: Reads object bytes
else fallback
Be->>GsDl: WFS GetFeature (availability and CSV)
end
Fe->>GsEx: Consumes WMS/WFS directly for maps and AOI geometry
Step-by-step explanation¶
- Job reads the adopter JDBC source.
dsp-job-data-migrationconnects to the source database (datasourcesource) and reads attributes and geometries within the watermark window (creation-date-column+ optionalupdated-at-column) and thewhere-clause. - Dual-write to both destinations. Each delta run writes simultaneously to:
dsp-db(datasourcetarget): business data,boundary_box, andcentroid_coordinatesβ without full geometry.geoserver-db(datasourcegeo-target): the same attributes, but with fullgeom. The watermark advances indata_migration.BATCH_JOB_EXECUTION_SYNC_STATEonly if the job finishesCOMPLETED.- Post-migration KPI job.
kpiCalculationJobreads geometries ingeoserver-db, computes each AOI area (ST_Area), and writesdsp.area_of_interest.areaondsp-db. For each configured theme it sums areas per layer and writesdsp.kpi_measure(area_of_interest_id,value,kpi_name). It runs after AOI and layers (@Order(3)). It does not change geo-target. Detail: KPI calculation. - Two GeoServers read geoserver-db. Both publish FeatureTypes from the same
dsp-geoserver-dband the samemapLayersConfig.json: - GeoServer Exhibition β WMS/WFS for map navigation.
- GeoServer Download β WFS used by the backend for exports when there is no pre-generated CSV.
- Geo-file job and SeaweedFS (real adopter).
dsp-job-geo-file-generationruns on a schedule (setup) when theobject-storageprofile is active. It does not read the watermark directly β the migration job owns the watermark. After each successful migration run, migration compares what changed since the previous watermark (same temporal window as the delta) and setsrequires_s3_file_regenerationon affected level 2 and 3 territories indsp-dbβ including parent municipalities when areas of interest changed. On first load (no watermark stored yet), all relevant territories are marked pending. On the next geo-file round, it lists only territories with that flag, reads features ingeoserver-db, generates CSVs per configured theme/format, and publishes to SeaweedFS (dsp-object-storage, S3 API); when each territory finishes, it clears the flag and setslast_generated_s3_file_at. Spring Batch metadata for geo-file lives in thegeo_file_generationschema ondsp-db(isolated fromdata_migration). If migration fails, flags are not changed β avoiding publishing downloads from incomplete data. In local demo without JDBC, object storage and geo-file are usually off; steps below that mention S3 do not apply. - Backend serves the API from dsp-db.
dsp-backendreads onlydsp-dbfor business data; because that database has no full geometry, the API does not expose whole polygons β only bounding box and centroid, plus operational attributes. Home cards useTotalizerService: count/sum of AOIareaand sums inkpi_measurebykpi_name, according toinstallation-config.json. Click/selection interactions that use these lightweight representations may be slightly less precise than the map drawing (performance trade-off; see Architecture β Data flow). - Downloads go through the backend. The UI calls
POST /downloads/searchandGET /downloads/file. The backend validates the territory indsp-db. If the pre-generated CSV exists in SeaweedFS, it returns those bytes; otherwise it queries GeoServer Download via WFS (internal URL on the Docker network). The browser does not download files directly from GeoServer or the bucket. - Maps still consume GeoServer Exhibition directly.
dsp-frontendconsumes WMS/WFS from Exhibition to draw layers and load AOI geometry β separate from file downloads.
With object storage, heavy export usually leaves the critical path of GeoServer Download; Download WFS remains the fallback. Full geometry stays in a single PostGIS (geoserver-db).
Full column contract per database: Databases.