Skip to main content

Read messages from a database table

A database table source reads new rows from a PostgreSQL table the sending system writes to, often called an outbox table. It reads rows in order and remembers where it stopped, so a row is never read twice.

Before you begin​

Have the following ready:

  1. The database host, port, database name, a user name and password. Read access to the table is enough; NEEV only ever reads.
  2. The schema and table the messages are written to.
  3. A watermark column that only goes up, such as an id sequence. Rows are read in order of this column.
  4. Optionally, the message column that holds each message. If you leave it empty, each row is sent as JSON.
  5. The admin role in the workspace.

1. Add the table​

  1. Open Sources and select New source.
  2. Select Database table.
  3. Enter a Name, for example Clinic outbox table, and choose the feed under Send messages into.
  4. Enter the Host, Port, Database, User name and Password.
  5. Under SSL, choose Require unless the database is on the same private network and has no TLS.
  6. Enter the Schema, Table, Watermark column and Message column.
  7. Under Start from, choose:
    • Rows added after it is switched on (recommended): rows already in the table are not read.
    • Every row already in the table: everything is read, oldest first.
  8. Optionally change how often to poll and how many rows to read per poll.
  9. Select Add source.

New database table source

2. Test the connection​

Select Test connection. NEEV connects, checks the table and columns, and says where it will start, for example "Connected to public.adt_outbox. When the source is switched on it starts after id 2; rows already there are not read."

3. Switch it on and read rows​

  1. Switch the source on. Read up to shows where it will start.
  2. To read straight away, select Poll now.

One new row read and accepted

The panel shows the last poll, for example "Read 1 row: 1 message, 1 accepted.", and Read up to moves to the newest row read.

How rows are read​

  • In order, from where it stopped. Each poll reads rows with a watermark above Read up to, oldest first, up to the rows-per-poll limit.
  • Read-only. The connection never writes to the table. Marking rows as sent is not needed and not done.
  • If the table is not there, the source cannot be switched on and says why, for example "There is no table public.adt_outbox, or this user cannot see it."