SUPPORT-8474: Fix
This commit is contained in:
parent
12a498f210
commit
3d7e8dcc68
5 changed files with 15 additions and 15 deletions
|
|
@ -30,8 +30,8 @@ public class ReplyingKafkaConfig {
|
|||
@Value("${ervu-kafka.group-id}")
|
||||
private String groupId;
|
||||
|
||||
@Value("${ervu-kafka.reply-connection-timeout:30}")
|
||||
private long connectionTimeout;
|
||||
@Value("${ervu-kafka.reply-timeout:30}")
|
||||
private long replyTimeout;
|
||||
|
||||
@Bean
|
||||
public ProducerFactory<String, String> producerFactory() {
|
||||
|
|
@ -80,7 +80,7 @@ public class ReplyingKafkaConfig {
|
|||
ReplyingKafkaTemplate<String, String, String> replyingKafkaTemplate =
|
||||
new ReplyingKafkaTemplate<>(pf, container);
|
||||
replyingKafkaTemplate.setCorrelationHeaderName("messageID");
|
||||
replyingKafkaTemplate.setDefaultReplyTimeout(Duration.ofSeconds(connectionTimeout));
|
||||
replyingKafkaTemplate.setDefaultReplyTimeout(Duration.ofSeconds(replyTimeout));
|
||||
return replyingKafkaTemplate;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import org.apache.kafka.clients.consumer.ConsumerRecord;
|
|||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.apache.kafka.common.header.internals.RecordHeader;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.kafka.requestreply.ReplyingKafkaTemplate;
|
||||
import org.springframework.kafka.requestreply.RequestReplyFuture;
|
||||
import org.springframework.kafka.support.KafkaHeaders;
|
||||
|
|
|
|||
|
|
@ -11,11 +11,7 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.time.Duration;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -395,10 +391,15 @@ public class EsiaAuthService {
|
|||
requestReplyTopic, objectMapper.writeValueAsString(orgInfo)
|
||||
);
|
||||
ErvuOrgResponse ervuOrgResponse = objectMapper.readValue(kafkaResponse, ErvuOrgResponse.class);
|
||||
Optional<String> ervuIdOptional = Arrays.stream(ervuOrgResponse.getData()).filter(data -> data.getPrnOid().equals(prnOid)).map(
|
||||
Data::getOrgId_ERVU).findAny();
|
||||
return ervuIdOptional.orElseThrow(() -> new RuntimeException(
|
||||
"No ervuId for prnOid = " + prnOid));
|
||||
List<String> listErvuId = Arrays.stream(ervuOrgResponse.getData()).filter(data -> data.getPrnOid().equals(prnOid)).map(
|
||||
Data::getOrgId_ERVU).toList();
|
||||
if (listErvuId.size() > 1) {
|
||||
throw new RuntimeException("More than one ervuId for prnOid = " + prnOid);
|
||||
}
|
||||
else if (listErvuId.isEmpty()) {
|
||||
throw new RuntimeException("No ervuId for prnOid = " + prnOid);
|
||||
}
|
||||
return listErvuId.get(0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ xa-data-source add \
|
|||
/system-property=ervu-kafka.org-reply-topic:add(value="ervu.organization.response")
|
||||
/system-property=ervu-kafka.group-id:add(value="1")
|
||||
/system-property=ervu-kafka.org-request-topic:add(value="ervu.organization.request")
|
||||
/system-property=ervu-kafka.reply-connection-timeout:add(value="30")
|
||||
/system-property=ervu-kafka.reply-timeout:add(value="30")
|
||||
/system-property=ervu.cron.load.enable(value="true")
|
||||
/system-property=ervu.cron.load.time(value="0 0 */1 * * *")
|
||||
/system-property=ervu.esnsi.classifier.url.load(value="https://esnsi.gosuslugi.ru/rest/ext/v1/classifiers/11465/file?extension=JSON&encoding=UTF_8"")
|
||||
|
|
@ -80,7 +80,7 @@
|
|||
<property name="ervu-kafka.org-reply-topic" value="ervu.organization.response"/>
|
||||
<property name="ervu-kafka.group-id" value="1"/>
|
||||
<property name="ervu-kafka.org-request-topic" value="ervu.organization.request"/>
|
||||
<property name="ervu-kafka.reply-connection-timeout" value="30"/>
|
||||
<property name="ervu-kafka.reply-timeout" value="30"/>
|
||||
<property name="client-cert-hash" value="04508B4B0B58776A954A0E15F574B4E58799D74C61EE020B3330716C203E3BDD"/>
|
||||
<property name="bpmn.enable" value="false"/>
|
||||
<property name="ervu.cron.load.time" value="0 0 */1 * * *"/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue