Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase http timeouts to 20 minutes and decouple app config from act… #9

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions exn-middleware-core/config/application-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ application:
port: '${ACTIVEMQ_PORT:5672}'
username: 'admin'
password: 'admin'
connectTimeout: 20 #min
readTimeout: 20 #min
sal:
protocol: 'http'
host: '${SAL_HOST:nebulous-sal}'
Expand Down
2 changes: 2 additions & 0 deletions exn-middleware-core/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ application:
port: '5672'
username: 'admin'
password: 'admin'
connectTimeout: 20 #min
readTimeout: 20 #min
sal:
protocol: 'http'
host: 'localhost'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package eu.nebulouscloud.exn.modules.sal.configuration

import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.context.annotation.Configuration

@Configuration
@ConfigurationProperties('application.exn.config')
class ExnConfig {

String url
Integer port
String username
String password
Long connectTimeout
Long readTimeout
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.nebulouscloud.exn.modules.sal.configuration

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.web.client.RestTemplateBuilder
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
Expand All @@ -10,11 +11,14 @@ import java.time.Duration
@Configuration
class RestTemplateConf {

@Autowired
ExnConfig config

@Bean
RestTemplate restTemplateInit(RestTemplateBuilder builder){

builder.setReadTimeout(Duration.ofMinutes(3))
.setConnectTimeout(Duration.ofMinutes(1))
builder.setConnectTimeout(Duration.ofMinutes(config.connectTimeout))
.setReadTimeout(Duration.ofMinutes(config.readTimeout))
.build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import eu.nebulouscloud.exn.modules.sal.middleware.handlers.connection.EXNConnec
import eu.nebulouscloud.exn.Connector
import eu.nebulouscloud.exn.core.Consumer
import eu.nebulouscloud.exn.core.Publisher
import eu.nebulouscloud.exn.modules.sal.configuration.AppConfig
import eu.nebulouscloud.exn.modules.sal.configuration.ExnConfig
import eu.nebulouscloud.exn.modules.sal.middleware.handlers.consumer.AMQPSalMessageHandler
import eu.nebulouscloud.exn.settings.StaticExnConfig
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
@ConfigurationProperties(prefix='application.exn')
class ConfigureEXNConnector {

AppConfig config
@Autowired
ExnConfig config

@Autowired
AMQPSalMessageHandler amqpSalMessageHandler
Expand Down