-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from boudicca-events/abl/de-eventify
Abl/de eventify
- Loading branch information
Showing
58 changed files
with
410 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
plugins { | ||
kotlin("jvm") | ||
kotlin("plugin.allopen") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
dependencies { | ||
api(project(":boudicca.base:semantic-conventions")) | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib") | ||
implementation(project(":boudicca.base:enricher-openapi")) | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(17)) | ||
vendor.set(JvmVendorSpec.ADOPTIUM) | ||
} | ||
} | ||
|
||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
kotlinOptions.javaParameters = true | ||
} |
36 changes: 36 additions & 0 deletions
36
boudicca.base/enricher-api/src/main/kotlin/base/boudicca/api/enricher/Enricher.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package base.boudicca.api.enricher | ||
|
||
import base.boudicca.Event | ||
import events.boudicca.enricher.openapi.ApiClient | ||
import events.boudicca.enricher.openapi.api.EnricherControllerApi | ||
import events.boudicca.enricher.openapi.model.EnrichRequestDTO | ||
|
||
class Enricher(enricherUrl: String) { | ||
|
||
private val enricherApi: EnricherControllerApi | ||
|
||
init { | ||
if (enricherUrl.isBlank()) { | ||
throw IllegalStateException("you need to pass an eventDbUrl!") | ||
} | ||
val apiClient = ApiClient() | ||
apiClient.updateBaseUri(enricherUrl) | ||
|
||
enricherApi = EnricherControllerApi(apiClient) | ||
} | ||
|
||
fun enrichEvents(events: List<Event>): List<Event> { | ||
return enricherApi.enrich(EnrichRequestDTO().events(events.map { mapToEnricherEvent(it) })).map { toEvent(it) } | ||
} | ||
|
||
private fun toEvent(enricherEvent: events.boudicca.enricher.openapi.model.Event): Event { | ||
return Event(enricherEvent.name, enricherEvent.startDate, enricherEvent.data ?: mapOf()) | ||
} | ||
|
||
private fun mapToEnricherEvent(event: Event): events.boudicca.enricher.openapi.model.Event { | ||
return events.boudicca.enricher.openapi.model.Event() | ||
.name(event.name) | ||
.startDate(event.startDate) | ||
.data(event.data) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ase/eventcollector-api/src/main/kotlin/base/boudicca/api/eventcollector/EventCollector.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...tcollector-api/src/main/kotlin/base/boudicca/api/eventcollector/EventCollectorDebugger.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ntcollector-api/src/main/kotlin/base/boudicca/api/eventcollector/TwoStepEventCollector.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
boudicca.base/eventdb/src/main/kotlin/base/boudicca/eventdb/BoudiccaEventDbProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package base.boudicca.eventdb | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
|
||
@ConfigurationProperties(prefix = "boudicca") | ||
data class BoudiccaEventDbProperties( | ||
val store: Store, | ||
val ingest: Ingest, | ||
val entryKeyNames: List<String>?, | ||
) | ||
|
||
data class Store( | ||
val path: String? | ||
) | ||
|
||
data class Ingest( | ||
val password: String? | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.