-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(infrastructure): exit application if cannot create broker subscription or blockchain subscription in the application runner * feat(infrastructure): exit application if cannot get access node public keys from external yaml * feat(infrastructure): exit application if cannot synchronize in startup * fix(service): remove consistency validation in p2p * build(gradle): change version
- Loading branch information
1 parent
68aae65
commit fb872dd
Showing
11 changed files
with
281 additions
and
536 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ plugins { | |
} | ||
|
||
group = 'es.in2' | ||
version = '1.0.6' | ||
version = '1.0.7' | ||
|
||
java { | ||
sourceCompatibility = '17' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/es/in2/desmos/application/workflows/jobs/impl/DataPublicationJobImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package es.in2.desmos.application.workflows.jobs.impl; | ||
|
||
import es.in2.desmos.application.workflows.jobs.DataPublicationJob; | ||
import es.in2.desmos.domain.models.*; | ||
import es.in2.desmos.domain.services.api.AuditRecordService; | ||
import es.in2.desmos.domain.services.broker.BrokerPublisherService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class DataPublicationJobImpl implements DataPublicationJob { | ||
private final AuditRecordService auditRecordService; | ||
private final BrokerPublisherService brokerPublisherService; | ||
|
||
public Mono<Void> verifyData(String processId, Mono<String> issuer, Mono<Map<Id, Entity>> entitiesByIdMono, Mono<List<MVEntity4DataNegotiation>> allMVEntity4DataNegotiation, Mono<Map<Id, HashAndHashLink>> existingEntitiesOriginalValidationDataById) { | ||
log.info("ProcessID: {} - Starting Data Verification Job", processId); | ||
|
||
return buildAndSaveAuditRecordFromDataSync(processId, issuer, entitiesByIdMono, allMVEntity4DataNegotiation, AuditRecordStatus.RETRIEVED) | ||
.then(createEntitiesToContextBroker(processId, entitiesByIdMono)) | ||
.then(buildAndSaveAuditRecordFromDataSync(processId, issuer, entitiesByIdMono, allMVEntity4DataNegotiation, AuditRecordStatus.PUBLISHED)); | ||
} | ||
|
||
private Mono<Void> buildAndSaveAuditRecordFromDataSync(String processId, Mono<String> issuerMono, Mono<Map<Id, Entity>> rcvdEntitiesByIdMono, Mono<List<MVEntity4DataNegotiation>> mvEntity4DataNegotiationListMono, AuditRecordStatus auditRecordStatus) { | ||
return Mono.zip(rcvdEntitiesByIdMono, mvEntity4DataNegotiationListMono) | ||
.flatMapMany(tuple -> { | ||
Map<Id, Entity> rcvdEntitiesById = tuple.getT1(); | ||
List<MVEntity4DataNegotiation> mvEntity4DataNegotiationList = tuple.getT2(); | ||
|
||
return Flux.fromIterable(mvEntity4DataNegotiationList) | ||
.filter(entity4DataNegotiation -> rcvdEntitiesById.containsKey(new Id(entity4DataNegotiation.id()))) | ||
.concatMap(entity4DataNegotiation -> issuerMono | ||
.flatMap(issuer -> { | ||
MVAuditServiceEntity4DataNegotiation mvAuditServiceEntity4DataNegotiation = new MVAuditServiceEntity4DataNegotiation(entity4DataNegotiation.id(), entity4DataNegotiation.type(), entity4DataNegotiation.hash(), entity4DataNegotiation.hashlink()); | ||
return auditRecordService.buildAndSaveAuditRecordFromDataSync(processId, issuer, mvAuditServiceEntity4DataNegotiation, auditRecordStatus); | ||
})); | ||
}) | ||
.collectList() | ||
.then(); | ||
} | ||
|
||
private Mono<Void> createEntitiesToContextBroker(String processId, Mono<Map<Id, Entity>> entitiesByIdMono) { | ||
return entitiesByIdMono | ||
.flatMapIterable(Map::entrySet) | ||
.flatMap(x -> brokerPublisherService.publishDataToBroker(processId, x.getKey().id(), x.getValue().value())) | ||
.collectList() | ||
.then(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.