Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Import Process
group-reports-consumer
Commits
4260b6bc
Commit
4260b6bc
authored
Oct 05, 2021
by
Jonas Waeber
Browse files
Update user agent.
Change url to https
parent
7160a064
Pipeline
#34099
failed with stages
in 1 minute and 23 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
helm-charts/templates/app-config.yml
View file @
4260b6bc
...
...
@@ -4,8 +4,9 @@ metadata:
name
:
"
{{
.Values.deploymentName
}}-app-config"
namespace
:
memobase
data
:
API_ENDPOINT_URL
:
"
http://{{
.Values.importApiName
}}-{{
.Values.k8sEnvironment}}-service:{{
.Values.importApiPort}}{{
.Values.importApiPath
}}"
API_ENDPOINT_URL
:
"
http
s
://{{
.Values.importApiName
}}-{{
.Values.k8sEnvironment}}-service:{{
.Values.importApiPort}}{{
.Values.importApiPath
}}"
STEP_WHITE_LIST_FILE_PATH
:
"
{{
.Values.whitelistFilePath
}}"
ENVIRONMENT
:
"
{{.Values.k8sEnvironment
}}"
APPLICATION_ID
:
"
{{
.Values.deploymentName
}}-{{
.Values.k8sEnvironment
}}-app"
TOPIC_IN
:
"
{{
.Values.inputTopic
}}"
TOPIC_OUT
:
"
not-used"
...
...
src/main/kotlin/ReportCollector.kt
View file @
4260b6bc
...
...
@@ -23,7 +23,7 @@ import org.apache.logging.log4j.LogManager
import
java.net.HttpURLConnection
import
java.net.URL
class
ReportCollector
(
private
val
importApiUrl
:
String
)
{
class
ReportCollector
(
importApiUrl
:
String
,
private
val
env
:
String
)
{
private
val
log
=
LogManager
.
getLogger
(
this
::
class
.
java
)
private
val
collection
=
mutableMapOf
<
String
,
ProcessReport
>()
private
val
requiredStepsForInstitutions
=
4
...
...
@@ -68,6 +68,7 @@ class ReportCollector(private val importApiUrl: String) {
http
.
doOutput
=
true
http
.
setFixedLengthStreamingMode
(
it
.
second
.
size
)
http
.
setRequestProperty
(
"Content-Type"
,
"application/json; charset=UTF-8"
)
http
.
setRequestProperty
(
"User-Agent"
,
"gi-reports-consumer-$env"
)
http
.
connect
()
http
.
outputStream
.
use
{
os
->
os
.
write
(
it
.
second
)
}
if
(
http
.
responseCode
>=
400
)
{
...
...
src/main/kotlin/Service.kt
View file @
4260b6bc
...
...
@@ -24,6 +24,7 @@ class Service(file: String = "app.yml") {
companion
object
{
const
val
importApiUrlSettingName
=
"importApiUrl"
const
val
whitelistFilePathSettingName
=
"whitelistFilePath"
const
val
envPropName
=
"env"
}
private
val
log
=
LogManager
.
getLogger
(
"GroupReportsConsumerService"
)
...
...
@@ -31,7 +32,8 @@ class Service(file: String = "app.yml") {
private
val
settings
=
SettingsLoader
(
listOf
(
importApiUrlSettingName
,
whitelistFilePathSettingName
whitelistFilePathSettingName
,
envPropName
),
file
,
useConsumerConfig
=
true
,
...
...
@@ -44,7 +46,7 @@ class Service(file: String = "app.yml") {
private
val
importApiUrl
=
settings
.
appSettings
[
importApiUrlSettingName
]
as
String
private
val
stepWhitelist
=
StepWhitelist
(
settings
.
appSettings
[
whitelistFilePathSettingName
]
as
String
)
val
collector
=
ReportCollector
(
importApiUrl
)
private
val
collector
=
ReportCollector
(
importApiUrl
,
settings
.
appSettings
.
getProperty
(
envPropName
)
)
fun
run
()
{
log
.
info
(
"Begin reading from topic ${settings.inputTopic} on kafka cluster."
)
...
...
src/main/resources/app.yml
View file @
4260b6bc
app
:
importApiUrl
:
${API_ENDPOINT_URL:?system}
whitelistFilePath
:
${STEP_WHITE_LIST_FILE_PATH:?system}
env
:
${ENVIRONMENT:?system}
kafka
:
consumer
:
bootstrap.servers
:
${KAFKA_BOOTSTRAP_SERVERS:?system}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment