This commit is contained in:
parent
a8c6ca0945
commit
780279fdcb
4 changed files with 31 additions and 8 deletions
|
|
@ -32,6 +32,10 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
#
|
||||
|
|
@ -216,9 +216,18 @@ public abstract class HazelcastServiceBase
|
|||
@Override
|
||||
public <T extends SpcexObjectBase> Imdg<T> getImdg(String key, Class<T> clazz) {
|
||||
ImdgHazelcast<T> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue