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>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,19 @@ securities-service.hazelcast.login=dev
|
||||||
securities-service.hazelcast.password=dev-pass
|
securities-service.hazelcast.password=dev-pass
|
||||||
|
|
||||||
securities-service.kafka.bootstrap-servers=localhost:9092
|
securities-service.kafka.bootstrap-servers=localhost:9092
|
||||||
securities-service.kafka.acks=all
|
securities-service.kafka.group-id=dev-group
|
||||||
securities-service.kafka.retries=0
|
securities-service.kafka.enable-auto-commit=false
|
||||||
securities-service.kafka.batch-size=16384
|
securities-service.kafka.session-timeout-ms=30000
|
||||||
|
securities-service.kafka.auto-offset-reset=latest
|
||||||
securities-service.kafka.linger-ms=1
|
securities-service.kafka.linger-ms=1
|
||||||
securities-service.kafka.buffer-memory=33554432
|
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
|
@Override
|
||||||
public <T extends SpcexObjectBase> Imdg<T> getImdg(String key, Class<T> clazz) {
|
public <T extends SpcexObjectBase> Imdg<T> getImdg(String key, Class<T> clazz) {
|
||||||
ImdgHazelcast<T> imdg = new ImdgHazelcast<>();
|
ImdgHazelcast<T> imdg = new ImdgHazelcast<>();
|
||||||
IdGenerator generator = hazelcastInstance.getIdGenerator(IMDGDistributedNames.MAP_SEQUENCE_NAME);
|
statusSubscribe(new IHazelcastClusterStatus() {
|
||||||
imdg.setMap(getHazelcast().getMap(key));
|
@Override
|
||||||
imdg.setIdGenerator(generator);
|
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;
|
return imdg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ru.spcex.clearing.platform.messaging.service;
|
package ru.spcex.clearing.platform.messaging.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.apache.kafka.clients.consumer.Consumer;
|
import org.apache.kafka.clients.consumer.Consumer;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||||
|
|
@ -45,7 +44,7 @@ public class QueueConsumer implements AutoCloseable {
|
||||||
}
|
}
|
||||||
} catch (WakeupException e) {
|
} catch (WakeupException e) {
|
||||||
if (!closed.get()) throw e;
|
if (!closed.get()) throw e;
|
||||||
} catch (JsonProcessingException e) {
|
} catch (Throwable e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
consumer.close();
|
consumer.close();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue