Skip to content

Commit

Permalink
Simplified ReactiveSagaInstanceRepositoryJdbc.find
Browse files Browse the repository at this point in the history
  • Loading branch information
dartartem committed Jul 27, 2021
1 parent 8e1fd3f commit 536389b
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,13 @@ public Mono<SagaInstance> find(String sagaType, String sagaId) {
(row, rowMetadata) -> new DestinationAndResource(row.get("destination").toString(), row.get("resource").toString()),
sagaType, sagaId);

Mono<List<SagaInstance>> result = destinationAndResources.collectList().flatMap(dar ->
return destinationAndResources.collectList().flatMap(dar ->
eventuateJdbcStatementExecutor.queryForList(sagaInstanceRepositorySql.getSelectFromSagaInstanceSql(),
(row, rowMetadata) ->
new SagaInstance(sagaType, sagaId, row.get("state_name").toString(),
row.get("last_request_id").toString(),
new SerializedSagaData(row.get("saga_data_type").toString(), row.get("saga_data_json").toString()), new HashSet<>(dar)),
sagaType, sagaId).collectList());

return result.flatMapMany(Flux::fromIterable).single();
sagaType, sagaId).single());
}


Expand Down

0 comments on commit 536389b

Please sign in to comment.