From 780279fdcb70d7c484daed5738d2f597b26489bf Mon Sep 17 00:00:00 2001 From: ialbert Date: Fri, 12 Aug 2022 14:51:42 +0300 Subject: [PATCH] http://jira.mfd.msk:8088/browse/CLS-16 --- clearing-parent/securities-service/pom.xml | 4 ++++ .../src/main/resources/application.properties | 17 ++++++++++++++--- .../hazelcast/service/HazelcastServiceBase.java | 15 ++++++++++++--- .../messaging/service/QueueConsumer.java | 3 +-- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/clearing-parent/securities-service/pom.xml b/clearing-parent/securities-service/pom.xml index 1c2aaf8b3..859ea7069 100644 --- a/clearing-parent/securities-service/pom.xml +++ b/clearing-parent/securities-service/pom.xml @@ -32,6 +32,10 @@ org.springframework.boot spring-boot-starter + + com.fasterxml.jackson.core + jackson-databind + diff --git a/clearing-parent/securities-service/src/main/resources/application.properties b/clearing-parent/securities-service/src/main/resources/application.properties index efa54f24f..65e23fde1 100644 --- a/clearing-parent/securities-service/src/main/resources/application.properties +++ b/clearing-parent/securities-service/src/main/resources/application.properties @@ -5,8 +5,19 @@ securities-service.hazelcast.login=dev securities-service.hazelcast.password=dev-pass securities-service.kafka.bootstrap-servers=localhost:9092 -securities-service.kafka.acks=all -securities-service.kafka.retries=0 -securities-service.kafka.batch-size=16384 +securities-service.kafka.group-id=dev-group +securities-service.kafka.enable-auto-commit=false +securities-service.kafka.session-timeout-ms=30000 +securities-service.kafka.auto-offset-reset=latest securities-service.kafka.linger-ms=1 securities-service.kafka.buffer-memory=33554432 +#props.put("bootstrap.servers", kafkaSettings.getBootstrapServers()); +#if (kafkaSettings.getGroupId() != null && kafkaSettings.getGroupId().length() > 0) { +# props.put("group.id", kafkaSettings.getGroupId()); +#} +#props.put("enable.auto.commit", kafkaSettings.getEnableAutoCommit().toString()); +#props.put("session.timeout.ms", kafkaSettings.getSessionTimeoutMs().toString()); +#props.put("auto.offset.reset", kafkaSettings.getAutoOffsetReset()); +#props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); +#props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); +# \ No newline at end of file diff --git a/platform-parent/platform-imdg-api-hazelcast-impl/src/main/java/ru/spcex/platform/imdg/iml/hazelcast/service/HazelcastServiceBase.java b/platform-parent/platform-imdg-api-hazelcast-impl/src/main/java/ru/spcex/platform/imdg/iml/hazelcast/service/HazelcastServiceBase.java index 850ddbf3d..d8b90795e 100644 --- a/platform-parent/platform-imdg-api-hazelcast-impl/src/main/java/ru/spcex/platform/imdg/iml/hazelcast/service/HazelcastServiceBase.java +++ b/platform-parent/platform-imdg-api-hazelcast-impl/src/main/java/ru/spcex/platform/imdg/iml/hazelcast/service/HazelcastServiceBase.java @@ -216,9 +216,18 @@ public abstract class HazelcastServiceBase @Override public Imdg getImdg(String key, Class clazz) { ImdgHazelcast imdg = new ImdgHazelcast<>(); - IdGenerator generator = hazelcastInstance.getIdGenerator(IMDGDistributedNames.MAP_SEQUENCE_NAME); - imdg.setMap(getHazelcast().getMap(key)); - imdg.setIdGenerator(generator); + statusSubscribe(new IHazelcastClusterStatus() { + @Override + public void getAvailable(HazelcastInstance hazelcastNotInited) { + IdGenerator generator = hazelcastInstance.getIdGenerator(IMDGDistributedNames.MAP_SEQUENCE_NAME); + imdg.setMap(hazelcastInstance.getMap(key)); + imdg.setIdGenerator(generator); + } + + @Override + public void getUnavailable(HazelcastInstance hazelcastNotInited) { + } + }); return imdg; } diff --git a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/service/QueueConsumer.java b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/service/QueueConsumer.java index f3186c7a2..d0859328e 100644 --- a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/service/QueueConsumer.java +++ b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/service/QueueConsumer.java @@ -1,6 +1,5 @@ package ru.spcex.clearing.platform.messaging.service; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.clients.consumer.ConsumerRecord; @@ -45,7 +44,7 @@ public class QueueConsumer implements AutoCloseable { } } catch (WakeupException e) { if (!closed.get()) throw e; - } catch (JsonProcessingException e) { + } catch (Throwable e) { throw new RuntimeException(e); } finally { consumer.close();