xml-importer saveRequestInfo disabled on kafka
This commit is contained in:
parent
4966cd552e
commit
d404d58d6c
3 changed files with 15 additions and 17 deletions
|
|
@ -11,14 +11,11 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.kafka.core.ProducerFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaConsumerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaProducerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfo;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
|
|
@ -60,10 +57,7 @@ public class KafkaConfig {
|
|||
.setup()
|
||||
.setKafkaTemplate(kafkaTemplate)
|
||||
.idGenerator(imdgIdGenerator::nextId)
|
||||
.imdgProvider(s -> {
|
||||
Imdg<RequestInfo> imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class);
|
||||
return imdg::insert;
|
||||
})
|
||||
.saveRequestInfo(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
@ -77,10 +71,7 @@ public class KafkaConfig {
|
|||
.setup()
|
||||
.setKafkaTemplate(kafkaTemplate)
|
||||
.idGenerator(imdgIdGenerator::nextId)
|
||||
.imdgProvider(s -> {
|
||||
Imdg<RequestInfo> imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class);
|
||||
return imdg::insert;
|
||||
})
|
||||
.saveRequestInfo(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,9 +99,9 @@ public class ImportToDB {
|
|||
bankAccountNewRequest.setOktmo(accountTagRub.getOktmo());
|
||||
// No DISCONTINUATION_DATE in BankAccountNewAction
|
||||
|
||||
kafkaMessenger.sendToBankAccount(bankAccountNewRequest);
|
||||
boolean sendResult = kafkaMessenger.sendToBankAccount(bankAccountNewRequest);
|
||||
|
||||
return StageResult.OK;
|
||||
return sendResult ? StageResult.OK : StageResult.ERROR;
|
||||
} else if (resultContainer.getXmlTable().equals(ETable.ACCOUNT_LIST_CUR)) {
|
||||
AccountTagCur accountTagCur = ((AccountListCur) resultContainer.getXmlFile())
|
||||
.getRegistrator()
|
||||
|
|
@ -128,9 +128,9 @@ public class ImportToDB {
|
|||
bankAccountNewRequest.setIntermediarySwiftCode2(accountTagCur.getIntermediarySwiftCode2());
|
||||
bankAccountNewRequest.setBankAccount2(accountTagCur.getBankAccount2());
|
||||
|
||||
kafkaMessenger.sendToBankAccount(bankAccountNewRequest);
|
||||
boolean sendResult = kafkaMessenger.sendToBankAccount(bankAccountNewRequest);
|
||||
|
||||
return StageResult.OK;
|
||||
return sendResult ? StageResult.OK : StageResult.ERROR;
|
||||
}
|
||||
|
||||
log.error("Table type {} is not supported", resultContainer.getXmlTable());
|
||||
|
|
|
|||
|
|
@ -56,9 +56,16 @@ public class XmlImportKafkaMessenger implements InitializingBean {
|
|||
messengers.put(ETable.DF_57, groupId -> messageStatement(groupId, SdfTable.SDF_57, FileType.SDF));
|
||||
}
|
||||
|
||||
public void sendToBankAccount(BankAccountNewRequest bankAccountNewRequest) {
|
||||
kafkaSdf.get().sendRequestToQueue(Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewRequest);
|
||||
public boolean sendToBankAccount(BankAccountNewRequest bankAccountNewRequest) {
|
||||
try {
|
||||
kafkaSdf.get().sendRequestToQueue(Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewRequest);
|
||||
} catch (Exception e) {
|
||||
log.error("Error occurred on sending message to kafka {}", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
log.info("Message to {} was sent {}", Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewRequest);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue