---
переименовал перфиксы в application.properties
пофиксил ConcurrentModificationException: KafkaConsumer is not safe for multi-threaded access
This commit is contained in:
aalehin 2022-09-15 13:23:21 +03:00
parent 7daedf9b26
commit 36caec87be
7 changed files with 14 additions and 6 deletions

View file

@ -2,14 +2,17 @@ package ru.spcex.clearing.company.config;
import org.apache.kafka.clients.consumer.Consumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import ru.spcex.clearing.company.config.settings.CompanyServiceSettings;
import ru.spcex.clearing.platform.messaging.config.KafkaConsumerFactory;
@Configuration
public class KafkaConfig {
@Autowired
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Bean
public Consumer<String, Object> createProducer(CompanyServiceSettings settings) {
return KafkaConsumerFactory.consumer(settings.getKafka());

View file

@ -8,7 +8,7 @@ import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
@Component
@PropertySource("file:${spring.config.location}/application.properties")
@ConfigurationProperties("utility-service")
@ConfigurationProperties("company-service")
public class CompanyServiceSettings {
private HazelcastClientParams hazelcast;
private KafkaConsumerSettings kafka;

View file

@ -20,7 +20,8 @@ public class ClearingMemberCategoryService extends QueueConsumer implements Init
private final Imdg<ClearingMemberCategory> clearingMemberCategoryMap;
@Autowired
public ClearingMemberCategoryService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
public ClearingMemberCategoryService(Consumer<String, Object> kafkaQueue,
ImdgProvider imdgProvider) {
super(kafkaQueue);
this.clearingMemberCategoryMap = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingMemberCategory, ClearingMemberCategory.class);
}

View file

@ -21,7 +21,8 @@ public class CompanyInfoService extends QueueConsumer implements InitializingBea
private final Imdg<CompanyInfo> companyInfoMap;
@Autowired
public CompanyInfoService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
public CompanyInfoService(Consumer<String, Object> kafkaQueue,
ImdgProvider imdgProvider) {
super(kafkaQueue);
this.companyInfoMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, CompanyInfo.class);
}

View file

@ -21,7 +21,8 @@ public class CompanyService extends QueueConsumer implements InitializingBean {
private final Imdg<Company> companyMap;
@Autowired
public CompanyService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
public CompanyService(Consumer<String, Object> kafkaQueue,
ImdgProvider imdgProvider) {
super(kafkaQueue);
this.companyMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
}

View file

@ -22,7 +22,8 @@ public class CompanySymbolService extends QueueConsumer implements InitializingB
private final Imdg<CompanySymbols> companySymbolsMap;
@Autowired
public CompanySymbolService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
public CompanySymbolService(Consumer<String, Object> kafkaQueue,
ImdgProvider imdgProvider) {
super(kafkaQueue);
this.companySymbolsMap = imdgProvider.getImdg(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class);
}

View file

@ -19,7 +19,8 @@ public class ContactService extends QueueConsumer implements InitializingBean {
private final Imdg<Contact> contactMap;
@Autowired
public ContactService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
public ContactService(Consumer<String, Object> kafkaQueue,
ImdgProvider imdgProvider) {
super(kafkaQueue);
this.contactMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Contact, Contact.class);
}