now the messageDocs is rely on the kafka setting, so we better set the default value for api_instance_id

This commit is contained in:
hongwei 2020-06-22 11:25:55 +02:00
parent 77ac521904
commit 9ff4ea02a9
2 changed files with 2 additions and 9 deletions

View File

@ -2639,12 +2639,9 @@ Returns a string showed to the developer
otherAccountRoutingAddress: String
)= createOBPId(s"$thisBankId$thisAccountId$counterpartyName$otherAccountRoutingScheme$otherAccountRoutingAddress")
//TODO, now we have the star connector, it will break the isSandboxMode method logic. Need to double check how to use this method now.
val isSandboxMode: Boolean = (APIUtil.getPropsValue("connector").openOrThrowException(attemptedToOpenAnEmptyBox).toString).equalsIgnoreCase("mapped")
//If we use kafka connector, we need set up kafka server first. For some cases(eg: get Kafka MessageDoc), we do not need kafka..
val isStarConnectorButNoKafkaSupport: Boolean =
(APIUtil.getPropsValue("connector").openOrThrowException(attemptedToOpenAnEmptyBox).toString).equalsIgnoreCase("star") && (!(APIUtil.getPropsValue("starConnector_supported_types").openOrThrowException(attemptedToOpenAnEmptyBox).toString).contains("kafka"))
/**
* This function is implemented in order to support encrypted values in props file.
* Please note that some value is considered as encrypted if has an encryption mark property in addition to regular props value in props file e.g

View File

@ -10,11 +10,7 @@ trait KafkaConfig {
val bootstrapServers = APIUtil.getPropsValue("kafka.bootstrap_hosts")openOr("localhost:9092")
val groupId = APIUtil.getPropsValue("kafka.group.id").openOr("obp-api")
val apiInstanceId =
if (APIUtil.isSandboxMode || APIUtil.isStarConnectorButNoKafkaSupport)
APIUtil.getPropsAsIntValue("api_instance_id").openOr("{api_instance_id}")
else
APIUtil.getPropsAsIntValue("api_instance_id").openOrThrowException(s"${ErrorMessages.MissingPropsValueAtThisInstance} api_instance_id")
val apiInstanceId = APIUtil.getPropsAsIntValue("api_instance_id").openOr("1")
val partitions = APIUtil.getPropsAsIntValue("kafka.partitions", 10)
val clientId = s"obp.api.$apiInstanceId"