public class PostgreSqlSink extends Object implements EventSink<GenericEvent>, Serializable, AutoCloseable
GenericEvent List in a Events table on a PostgreSQL database.| Constructor and Description |
|---|
PostgreSqlSink(String url,
String user,
String password)
Main constructor, builds up the connection to the PostgreSql database.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the PostgreSQL connection.
|
List<GenericEvent> |
executeQuery(String query)
Runs the given query on the database connected and gets results in
GenericEvent type as a List. |
void |
handle(GenericEvent event)
Is called by the pipeline whenever a new GenericEvent is received.
|
void |
persist(List<GenericEvent> events)
Saves the
List of GenericEvents into the connected PostgreSQL database. |
public List<GenericEvent> executeQuery(String query)
GenericEvent type as a List.query - to be executed (Only select methods and similar, no create or insert and so on).List of GenericEvent results from the executed query.public void persist(List<GenericEvent> events)
List of GenericEvents into the connected PostgreSQL database.events - to be saved into the database.public void handle(GenericEvent event)
GenericEvent value in the PostgreSQL database.handle in interface EventSink<GenericEvent>event - GenericEvent that is generated by the pipeline.public void close()
close in interface AutoCloseableCopyright © 2018 pragmatic minds GmbH. All rights reserved.