- https://www.postgresql.org/docs/
- https://www.postgresql.org/docs/current/sql-commands.html
- https://jdbc.postgresql.org/documentation/
- Persisting real-time transactional data
- Streaming analytics aggregation into materialized tables
- Logging and audit trails
- Compliance data retention
- Integration with BI tools or custom SQL-based applications
- Executes parameterized SQL statements for each incoming Kafka event.
- Maps Kafka message fields to SQL query parameters.
- Supports secure connections to PostgreSQL using username/password authentication.
- Persists streaming events into relational tables with retry and error handling.
- Data is consumed from the configured Kafka input topic.
- Each event is parsed and mapped to the configured SQL query.
- The connector establishes a secure connection to the PostgreSQL database.
- The SQL statement is executed using the mapped event values.
- Connector logs, retries, and monitoring ensure reliable delivery.
Field-by-Field Explanation
1. Title
- Description: User-defined name used to identify the connector.
- Example:
postgres-output-iot-events
2. Server Name
- Description: Hostname or IP address of the PostgreSQL server.
- Example:
postgres.example.com
3. Server Port
- Description: TCP port used by PostgreSQL.
- Default:
5432 - Example:
5432
4. Database Name
- Description: Name of the PostgreSQL database.
- Example:
telematics_db
5. Username
- Description: PostgreSQL user with permission to execute the configured SQL query.
- Example:
condense_writer
6. Password
- Description: Password for the PostgreSQL user.
- Example:
********
7. Query
- Description: SQL statement executed for every incoming Kafka event.
- Example:
8. Topic (Input)
- Description: Condense Kafka topic whose events are written to PostgreSQL.
- Example:
iot.device.raw
- Verify the hostname, port, credentials, and network connectivity.
- Ensure the number of SQL placeholders matches the incoming event fields.
- Validate SQL syntax.
- Confirm that the target table and columns exist.
- Use fully qualified table names when required.
- Ensure the PostgreSQL user has INSERT, UPDATE, or other required privileges.
- Verify PostgreSQL SSL configuration and client certificates when SSL is enabled.
- Use connection pooling (for example, pgBouncer) for high-throughput deployments.
- Use
INSERT ... ON CONFLICTor UPSERT queries to prevent duplicate records during retries.
- Store timestamps using
timestamptzor normalize values to UTC.
- Store complete Kafka payloads in
jsonbcolumns when schema flexibility is required.
- Partition large tables by time or another key to improve write and query performance.
- Always use parameterized SQL queries.
- Keep each transaction lightweight.
- Monitor connector logs and latency.
- Index frequently queried columns.
- Rotate database credentials regularly and store them securely.