Skip to content
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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Valtimo plugin voor het versturen van e-mail via de Microsoft Graph API met OAut

- [Getting Started](documentation/getting-started.md) — installatie en buildinstructies
- [Plugin Documentatie](documentation/plugin.md) — pluginconfiguratie, acties en aandachtspunten

- [Release notes](documentation/release-notes.md) — versiegeschiedenis en wijzigingen
8 changes: 5 additions & 3 deletions backend/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
val kotlinLoggingVersion: String by project
val nettyResolverDnsNativeMacOsVersion: String by project

val valtimoVersion: String by project

dependencies {
implementation(platform("com.ritense.valtimo:valtimo-dependency-versions"))
implementation(platform("com.ritense.valtimo:valtimo-dependency-versions:$valtimoVersion"))

implementation("com.ritense.valtimo:valtimo-dependencies")
implementation("com.ritense.valtimo:local-mail")
implementation("com.ritense.valtimo:valtimo-dependencies:$valtimoVersion")
implementation("com.ritense.valtimo:local-mail:$valtimoVersion")

implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.postgresql:postgresql")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import java.time.Duration
// swallows the rest of the file. Keeping all doc text in line comments avoids that trap.
@AutoConfiguration
class GraphMailAutoConfiguration {

private val logger = LoggerFactory.getLogger(GraphMailAutoConfiguration::class.java)

// Fired once after the full application context is ready.
Expand All @@ -34,9 +33,9 @@ class GraphMailAutoConfiguration {
fun warnOnStartup() {
logger.warn(
"[Graph Mail Plugin] IMPORTANT: this plugin blocks Operaton job-executor threads during " +
"retry backoff (up to 30s per send, 120s for large attachments). " +
"Set operaton.bpm.job-executor.core-pool-size >= 20 and max-pool-size >= 50 " +
"to prevent job-executor starvation under load. See documentation/plugin.md for details."
"retry backoff (up to 30s per send, 120s for large attachments). " +
"Set operaton.bpm.job-executor.core-pool-size >= 20 and max-pool-size >= 50 " +
"to prevent job-executor starvation under load. See documentation/plugin.md for details.",
)
}

Expand All @@ -46,11 +45,12 @@ class GraphMailAutoConfiguration {
restTemplateBuilder: RestTemplateBuilder,
objectMapper: ObjectMapper,
): GraphMailClient {
val restTemplate = restTemplateBuilder
.connectTimeout(Duration.ofSeconds(10))
.readTimeout(Duration.ofSeconds(30))
.build()
.also { configureJackson(it, objectMapper) }
val restTemplate =
restTemplateBuilder
.connectTimeout(Duration.ofSeconds(10))
.readTimeout(Duration.ofSeconds(30))
.build()
.also { configureJackson(it, objectMapper) }

return GraphMailClientImpl(RestClient.create(restTemplate))
}
Expand All @@ -63,9 +63,14 @@ class GraphMailAutoConfiguration {
objectMapper: ObjectMapper,
resourceStorageService: TemporaryResourceStorageService,
eventPublisher: ApplicationEventPublisher,
): GraphMailPluginFactory = GraphMailPluginFactory(
pluginService, restTemplateBuilder, objectMapper, resourceStorageService, eventPublisher
)
): GraphMailPluginFactory =
GraphMailPluginFactory(
pluginService,
restTemplateBuilder,
objectMapper,
resourceStorageService,
eventPublisher,
)

@Bean
@ConditionalOnMissingBean(GraphMailTestSendController::class)
Expand All @@ -80,7 +85,10 @@ class GraphMailAutoConfiguration {
@ConditionalOnMissingBean(GraphMailHttpSecurityConfigurer::class)
fun graphMailHttpSecurityConfigurer(): GraphMailHttpSecurityConfigurer = GraphMailHttpSecurityConfigurer()

private fun configureJackson(restTemplate: RestTemplate, objectMapper: ObjectMapper) {
private fun configureJackson(
restTemplate: RestTemplate,
objectMapper: ObjectMapper,
) {
restTemplate.messageConverters.removeIf { it is MappingJackson2HttpMessageConverter }
restTemplate.messageConverters.add(0, MappingJackson2HttpMessageConverter(objectMapper))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ package com.ritense.valtimoplugins.graphmail
* (Mockito, MockK, Spring Test) without coupling to the HTTP implementation.
*/
interface GraphMailClient {

fun sendMail(
tenantId: String,
clientId: String,
Expand All @@ -31,5 +30,8 @@ interface GraphMailClient {
* Invalidate the cached token for one tenant/client pair.
* If both args are null the entire cache is flushed (rare — global compromise).
*/
fun invalidateCache(tenantId: String? = null, clientId: String? = null)
fun invalidateCache(
tenantId: String? = null,
clientId: String? = null,
)
}
Loading
Loading