Skip to content

Commit

Permalink
Merge pull request #2293 from hongwei1/develop
Browse files Browse the repository at this point in the history
refactor/set the default api_instance_id to UUID
  • Loading branch information
simonredfern committed Oct 13, 2023
2 parents c04a7e4 + 957f6c5 commit c771333
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
7 changes: 5 additions & 2 deletions obp-api/src/main/resources/props/sample.props.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 a value is set, OBP will concatenate the UUID string with the value.
#api_instance_id=1
api_instance_id=1_final
#When the value is set to conclude with "final," OBP will preserve that value.
#api_instance_id=1_final

## DEPRECATED
## Enable user authentication via kafka
Expand Down
3 changes: 0 additions & 3 deletions obp-api/src/main/resources/props/test.default.props.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
### if logger.logfile is defined
#logger.logfile="obp-api.log"

#This is the api instance
api_instance_id=1_final

#which data connector to use

#connector=rest
Expand Down
12 changes: 8 additions & 4 deletions obp-api/src/main/scala/code/api/constant/constant.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,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()
}
}

Expand Down
2 changes: 1 addition & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-persistent 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
Expand Down

0 comments on commit c771333

Please sign in to comment.