@@ -306,7 +306,7 @@ private void setUpEncryptedRoutes(Router mainRouter, BodyHandler bodyHandler) {
306
306
mainRouter .post (V2_IDENTITY_BUCKETS .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
307
307
rc -> encryptedPayloadHandler .handle (rc , this ::handleBucketsV2 ), Role .MAPPER ));
308
308
mainRouter .post (V2_IDENTITY_MAP .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
309
- rc -> encryptedPayloadHandler .handle (rc , this ::handleIdentityMapV2 ), Role .MAPPER ));
309
+ rc -> encryptedPayloadHandler .handleIdentityMap (rc , this ::handleIdentityMapV2 ), Role .MAPPER ));
310
310
mainRouter .post (V2_KEY_LATEST .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
311
311
rc -> encryptedPayloadHandler .handle (rc , this ::handleKeysRequestV2 ), Role .ID_READER ));
312
312
mainRouter .post (V2_KEY_SHARING .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
@@ -1663,7 +1663,8 @@ private boolean validateServiceLink(RoutingContext rc) {
1663
1663
return false ;
1664
1664
}
1665
1665
1666
- private void handleIdentityMapV2 (RoutingContext rc ) {
1666
+ private Future <Void > handleIdentityMapV2 (RoutingContext rc ) {
1667
+ final Promise <Void > promise = Promise .promise ();
1667
1668
try {
1668
1669
final Integer siteId = RoutingContextUtil .getSiteId (rc );
1669
1670
final String apiContact = RoutingContextUtil .getApiContact (rc , clientKeyProvider );
@@ -1672,16 +1673,39 @@ private void handleIdentityMapV2(RoutingContext rc) {
1672
1673
final InputUtil .InputVal [] inputList = getIdentityMapV2Input (rc );
1673
1674
if (inputList == null ) {
1674
1675
ResponseUtil .LogInfoAndSend400Response (rc , this .phoneSupport ? ERROR_INVALID_INPUT_WITH_PHONE_SUPPORT : ERROR_INVALID_INPUT_EMAIL_MISSING );
1675
- return ;
1676
+ promise .complete ();
1677
+ return promise .future ();
1676
1678
}
1677
1679
1678
- if (!validateServiceLink (rc )) { return ; }
1680
+ if (!validateServiceLink (rc )) {
1681
+ promise .complete ();
1682
+ return promise .future ();
1683
+ }
1679
1684
1680
- final JsonObject resp = handleIdentityMapCommon (rc , inputList );
1681
- ResponseUtil .SuccessV2 (rc , resp );
1685
+ vertx .executeBlocking (
1686
+ blockingPromise -> {
1687
+ try {
1688
+ final JsonObject resp = handleIdentityMapCommon (rc , inputList );
1689
+ blockingPromise .complete (resp );
1690
+ } catch (Exception e ) {
1691
+ blockingPromise .fail (e );
1692
+ }},
1693
+ false ,
1694
+ resp -> {
1695
+ if (resp .succeeded ()) {
1696
+ if (!rc .response ().ended ()) {
1697
+ ResponseUtil .SuccessV2 (rc , resp .result ());
1698
+ }
1699
+ } else {
1700
+ ResponseUtil .LogErrorAndSendResponse (ResponseStatus .UnknownError , 500 , rc , "Unknown error while mapping identity v2" , (Exception ) resp .cause ());
1701
+ }
1702
+ promise .complete ();
1703
+ });
1682
1704
} catch (Exception e ) {
1683
1705
ResponseUtil .LogErrorAndSendResponse (ResponseStatus .UnknownError , 500 , rc , "Unknown error while mapping identity v2" , e );
1706
+ promise .fail (e );
1684
1707
}
1708
+ return promise .future ();
1685
1709
}
1686
1710
1687
1711
private InputUtil .InputVal [] getIdentityMapV2Input (RoutingContext rc ) {
0 commit comments