--- переименовал перфиксы в application.properties пофиксил ConcurrentModificationException: KafkaConsumer is not safe for multi-threaded access
This commit is contained in:
parent
7daedf9b26
commit
36caec87be
7 changed files with 14 additions and 6 deletions
|
|
@ -2,14 +2,17 @@ package ru.spcex.clearing.company.config;
|
||||||
|
|
||||||
import org.apache.kafka.clients.consumer.Consumer;
|
import org.apache.kafka.clients.consumer.Consumer;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
import ru.spcex.clearing.company.config.settings.CompanyServiceSettings;
|
import ru.spcex.clearing.company.config.settings.CompanyServiceSettings;
|
||||||
import ru.spcex.clearing.platform.messaging.config.KafkaConsumerFactory;
|
import ru.spcex.clearing.platform.messaging.config.KafkaConsumerFactory;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class KafkaConfig {
|
public class KafkaConfig {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
@Bean
|
@Bean
|
||||||
public Consumer<String, Object> createProducer(CompanyServiceSettings settings) {
|
public Consumer<String, Object> createProducer(CompanyServiceSettings settings) {
|
||||||
return KafkaConsumerFactory.consumer(settings.getKafka());
|
return KafkaConsumerFactory.consumer(settings.getKafka());
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@PropertySource("file:${spring.config.location}/application.properties")
|
@PropertySource("file:${spring.config.location}/application.properties")
|
||||||
@ConfigurationProperties("utility-service")
|
@ConfigurationProperties("company-service")
|
||||||
public class CompanyServiceSettings {
|
public class CompanyServiceSettings {
|
||||||
private HazelcastClientParams hazelcast;
|
private HazelcastClientParams hazelcast;
|
||||||
private KafkaConsumerSettings kafka;
|
private KafkaConsumerSettings kafka;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ public class ClearingMemberCategoryService extends QueueConsumer implements Init
|
||||||
private final Imdg<ClearingMemberCategory> clearingMemberCategoryMap;
|
private final Imdg<ClearingMemberCategory> clearingMemberCategoryMap;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ClearingMemberCategoryService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
|
public ClearingMemberCategoryService(Consumer<String, Object> kafkaQueue,
|
||||||
|
ImdgProvider imdgProvider) {
|
||||||
super(kafkaQueue);
|
super(kafkaQueue);
|
||||||
this.clearingMemberCategoryMap = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingMemberCategory, ClearingMemberCategory.class);
|
this.clearingMemberCategoryMap = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingMemberCategory, ClearingMemberCategory.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ public class CompanyInfoService extends QueueConsumer implements InitializingBea
|
||||||
private final Imdg<CompanyInfo> companyInfoMap;
|
private final Imdg<CompanyInfo> companyInfoMap;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public CompanyInfoService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
|
public CompanyInfoService(Consumer<String, Object> kafkaQueue,
|
||||||
|
ImdgProvider imdgProvider) {
|
||||||
super(kafkaQueue);
|
super(kafkaQueue);
|
||||||
this.companyInfoMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, CompanyInfo.class);
|
this.companyInfoMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, CompanyInfo.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ public class CompanyService extends QueueConsumer implements InitializingBean {
|
||||||
private final Imdg<Company> companyMap;
|
private final Imdg<Company> companyMap;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public CompanyService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
|
public CompanyService(Consumer<String, Object> kafkaQueue,
|
||||||
|
ImdgProvider imdgProvider) {
|
||||||
super(kafkaQueue);
|
super(kafkaQueue);
|
||||||
this.companyMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
this.companyMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ public class CompanySymbolService extends QueueConsumer implements InitializingB
|
||||||
private final Imdg<CompanySymbols> companySymbolsMap;
|
private final Imdg<CompanySymbols> companySymbolsMap;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public CompanySymbolService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
|
public CompanySymbolService(Consumer<String, Object> kafkaQueue,
|
||||||
|
ImdgProvider imdgProvider) {
|
||||||
super(kafkaQueue);
|
super(kafkaQueue);
|
||||||
this.companySymbolsMap = imdgProvider.getImdg(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class);
|
this.companySymbolsMap = imdgProvider.getImdg(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ public class ContactService extends QueueConsumer implements InitializingBean {
|
||||||
private final Imdg<Contact> contactMap;
|
private final Imdg<Contact> contactMap;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ContactService(Consumer<String, Object> kafkaQueue, ImdgProvider imdgProvider) {
|
public ContactService(Consumer<String, Object> kafkaQueue,
|
||||||
|
ImdgProvider imdgProvider) {
|
||||||
super(kafkaQueue);
|
super(kafkaQueue);
|
||||||
this.contactMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Contact, Contact.class);
|
this.contactMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Contact, Contact.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue