refactor/set default api_instance_id to UUID

This commit is contained in:
hongwei 2023-10-13 15:14:49 +02:00
parent 7077e68bb0
commit 0745b085c4
3 changed files with 14 additions and 7 deletions

View File

@ -123,9 +123,12 @@ long_endpoint_timeout = 55000
#This is the api instance, we create kafka topic based on this number, each instance should have each own id. use it in load balancing + Kafka setup
#This is also used for scheduler.
#OBP will concatenate the UUID string with the value. If we set the value to end with "final", obp will retain that value.
#OBP set the default as the non persistent UUID string .
#api_instance_id=7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh
#if set value, OBP will concatenate the UUID string with the value.
#api_instance_id=1
api_instance_id=1_final
# when set the value to end with "final", obp will retain that value.
#api_instance_id=1_final
## DEPRECATED
## Enable user authentication via kafka

View File

@ -23,11 +23,15 @@ object Constant extends MdcLoggable {
final val HostName = APIUtil.getPropsValue("hostname").openOrThrowException(ErrorMessages.HostnameNotSpecified)
final val ApiInstanceId = {
val apiInstanceIdFromProps = APIUtil.getPropsValue("api_instance_id").openOrThrowException(ErrorMessages.ApiInstanceIdNotSpecified)
if(apiInstanceIdFromProps.endsWith("final")){
apiInstanceIdFromProps
val apiInstanceIdFromProps = APIUtil.getPropsValue("api_instance_id")
if(apiInstanceIdFromProps.isDefined){
if(apiInstanceIdFromProps.head.endsWith("final")){
apiInstanceIdFromProps.head
}else{
s"${apiInstanceIdFromProps.head}_${APIUtil.generateUUID()}"
}
}else{
s"${apiInstanceIdFromProps}_${APIUtil.generateUUID()}"
APIUtil.generateUUID()
}
}

View File

@ -122,7 +122,7 @@ Date Commit Action
1. accountaccess_backup_2019_05_17_11_16_32_134
2. viewdefinition_backup_2019_05_17_11_16_31_862
29/04/2019 a6b58a1 Added Props system_environment_property_name_prefix, default is OBP_. This adds the prefix only for the system environment property name, eg: db.driver --> OBP_db.driver
07/07/2018 4944572 Added Props api_instance_id, default is 1. This deceides the current api instance number, start from 1.
07/07/2018 4944572 Added Props api_instance_id, default is non persistence UUID 7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh.
29/06/2018 7422894 Added Props logging.database.queries.enable, default is false. This should enable logging all the database queries in log file.
01/06/2018 a286684 Added Props write_connector_metrics, default is false. This decides whether the connector level metric save or not
29/05/2018 c0d50b5 Added Props kafka.partitions, default is 3. This should match the partitions in Kafka config