diff options
author | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-07-18 09:23:00 +0200 |
---|---|---|
committer | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-07-18 09:23:00 +0200 |
commit | 6d30f261c618a3b69a8f1be092056383e6dea424 (patch) | |
tree | 86a5674d17a2d11c6ec327d4e36e8f589e2bbf7b /src/main/java/at/gv/egiz/moazs/preprocess | |
parent | f2e1263702901581512131ea587fad7a2ba45baa (diff) | |
download | moa-zs-6d30f261c618a3b69a8f1be092056383e6dea424.tar.gz moa-zs-6d30f261c618a3b69a8f1be092056383e6dea424.tar.bz2 moa-zs-6d30f261c618a3b69a8f1be092056383e6dea424.zip |
Integrate Mzs Service Timeout and Handle Async Responses
- Service Timeout : Add service timeout to mzs schema (DeliveryRequest
/ Config), application.yaml, convert service timeout from spring
environment to Config, and merge service timeouts in Configs.
- Handling of Asynchronous DeliveryRequestStatus: Move "Applying
Response Sinks" from backend into dedicated component
"MsgResponseSinkHub" and integrate SinkHub into MzsService (apply
sinks to asynchronous responses).
- Remove line breaks in SignatureVerifier's log statements.
- Revise documentation of parameters in application.yaml.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/preprocess')
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java b/src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java index a3329cd..056f6dc 100644 --- a/src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java +++ b/src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java @@ -31,7 +31,7 @@ public class ConfigUtil { public static final String FILENAME_KEY = "filename"; public static final String FILETYPE_KEY = "filetype"; public static final String PASSWORD_KEY = "password"; - public static final String RECEIVE_TIMEOUT = "receive-timeout"; + public static final String RECEIVE_TIMEOUT_KEY = "receive-timeout"; public static final String CONNECTION_TIMEOUT_KEY = "connection-timeout"; public static final String MSG_RESPONSE_SINKS_KEY = "msg-response-sinks"; public static final String LOG_RESPONSE_KEY = "log-response"; @@ -40,6 +40,7 @@ public class ConfigUtil { public static final String SAVE_RESPONSE_TO_FILE_PATH_KEY = "path"; public static final String FORWARD_RESPONSE_TO_SERVICE_KEY = "forward-response-to-service"; public static final String MZS_CLIENT_KEY = "mzs-client"; + public static final String SERVICE_TIMEOUT_KEY = "service-timeout"; /** @@ -64,11 +65,14 @@ public class ConfigUtil { MsgResponseSinksType sinks = msgResponseSinksParams.isEmpty() ? null : buildMsgResponseSinks(msgResponseSinksParams); + var serviceTimeout = bigIntOrNull(values.get(SERVICE_TIMEOUT_KEY)); + return ConfigType.configTypeBuilder() .withPerformQueryPersonRequest(performQueryPersonRequest) .withMSGClient(msgClient) .withTNVZClient(tnvzClient) .withMsgResponseSinks(sinks) + .withServiceTimeout(serviceTimeout) .build(); } @@ -83,13 +87,9 @@ public class ConfigUtil { var url = clientParams.get(URL_KEY); - BigInteger connectionTimeout = clientParams.containsKey(CONNECTION_TIMEOUT_KEY) - ? new BigInteger(clientParams.get(CONNECTION_TIMEOUT_KEY)) - : null; + var connectionTimeout = bigIntOrNull(clientParams.get(CONNECTION_TIMEOUT_KEY)); - BigInteger receiveTimeout = clientParams.containsKey(RECEIVE_TIMEOUT) - ? new BigInteger(clientParams.get(RECEIVE_TIMEOUT)) - : null; + var receiveTimeout = bigIntOrNull(clientParams.get(RECEIVE_TIMEOUT_KEY)); var sslParams = filterMapByPrefix(clientParams, SSL_KEY); SSLType ssl = sslParams.isEmpty() @@ -179,6 +179,11 @@ public class ConfigUtil { return value == null ? null : Boolean.getBoolean(value); } + private BigInteger bigIntOrNull(String value) { + return value == null + ? null + : new BigInteger(value); + } /** * Combine properties of two Configs; {@code primary} overrides {@code fallback}. @@ -207,6 +212,10 @@ public class ConfigUtil { builder.withMsgResponseSinks(merge(primary.getMsgResponseSinks(), fallback.getMsgResponseSinks())); } + if (primary.getServiceTimeout() != null) { + builder.withServiceTimeout(primary.getServiceTimeout()); + } + return builder.build(); } |