@@ -306,7 +306,7 @@ private void setUpEncryptedRoutes(Router mainRouter, BodyHandler bodyHandler) {
306306 mainRouter .post (V2_IDENTITY_BUCKETS .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
307307 rc -> encryptedPayloadHandler .handle (rc , this ::handleBucketsV2 ), Role .MAPPER ));
308308 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 ));
310310 mainRouter .post (V2_KEY_LATEST .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
311311 rc -> encryptedPayloadHandler .handle (rc , this ::handleKeysRequestV2 ), Role .ID_READER ));
312312 mainRouter .post (V2_KEY_SHARING .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
@@ -1663,7 +1663,8 @@ private boolean validateServiceLink(RoutingContext rc) {
16631663 return false ;
16641664 }
16651665
1666- private void handleIdentityMapV2 (RoutingContext rc ) {
1666+ private Future <Void > handleIdentityMapV2 (RoutingContext rc ) {
1667+ final Promise <Void > promise = Promise .promise ();
16671668 try {
16681669 final Integer siteId = RoutingContextUtil .getSiteId (rc );
16691670 final String apiContact = RoutingContextUtil .getApiContact (rc , clientKeyProvider );
@@ -1672,16 +1673,39 @@ private void handleIdentityMapV2(RoutingContext rc) {
16721673 final InputUtil .InputVal [] inputList = getIdentityMapV2Input (rc );
16731674 if (inputList == null ) {
16741675 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 ();
16761678 }
16771679
1678- if (!validateServiceLink (rc )) { return ; }
1680+ if (!validateServiceLink (rc )) {
1681+ promise .complete ();
1682+ return promise .future ();
1683+ }
16791684
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+ });
16821704 } catch (Exception e ) {
16831705 ResponseUtil .LogErrorAndSendResponse (ResponseStatus .UnknownError , 500 , rc , "Unknown error while mapping identity v2" , e );
1706+ promise .fail (e );
16841707 }
1708+ return promise .future ();
16851709 }
16861710
16871711 private InputUtil .InputVal [] getIdentityMapV2Input (RoutingContext rc ) {
0 commit comments