Doświadczenia praktyczne*
Nawet jak jest opisem błędu
Najlepiej w zautomatyzowany sposób
ConnectionFactoryOptions options = ConnectionFactoryOptions.builder() .option(ConnectionFactoryOptions.HOST, "localhost") .option(ConnectionFactoryOptions.PORT, 15432) .option(ConnectionFactoryOptions.DATABASE, "postgres") .option(ConnectionFactoryOptions.USER, "r2dbc") .option(ConnectionFactoryOptions.PASSWORD, "r2dbc") .option(ConnectionFactoryOptions.DRIVER, "postgresql") .build(); ConnectionFactory connectionFactory = ConnectionFactories.get(options); Publisher<? extends Connection> conn = connectionFactory.create();
Flux.from(conn) .map(c -> c.createStatement(ALL_MEMBERS)) .flatMap(Statement::execute) .flatMap(r -> r.map(memberMapper::fromRow)) .map(Member::getMemId) .blockLast();
Flux.from(conn) .map( c -> { c.beginTransaction(); c.setAutoCommit(true); return c; } ).map( c -> c.createStatement(INSERT_BOOKING) .bind(0, 1) .bind(1, 1) .bind(2, now()) .bind(3, 1) ) .flatMap(Statement::execute) .flatMap(Result::getRowsUpdated) .blockLast();
R2dbcException