Şöyle yaparız
IMap<Long, String> myMap = ...;
Pipeline p = Pipeline.create();
p.readFrom(Sources.mapJournal(myMap, START_FROM_CURRENT))
.withoutTimestamps()
.writeTo(Sinks.jdbc("%some update query%", () -> {
BaseDataSource dataSource = new PGXADataSource();
dataSource.setUrl("jdbc:postgresql://localhost:5432/my_db");
dataSource.setUser("postgres");
dataSource.setPassword("postgres");
dataSource.setDatabaseName("my_db");
return dataSource;
}, (stmt, record) -> {
// fill query params and execute
}));
Hiç yorum yok:
Yorum Gönder