-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8053d7
commit 4f8475b
Showing
38 changed files
with
571 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
axoniq: | ||
axonserver: | ||
name: eventstore-transformations-local | ||
hostname: localhost | ||
#standalone: true | ||
autocluster: | ||
first: | ||
contexts: default | ||
accesscontrol: | ||
enabled: false | ||
devmode: | ||
enabled: true |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Please use one of the following templates: | ||
|
||
https://github.com/GITHUB_ORGANIZATION/GITHUB_REPOSITORY/issues/new/choose | ||
https://github.com/holixon/axon-event-transformation-example/issues/new/choose |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.docker/data/ | ||
.docker/events/ | ||
target/ | ||
|
||
pom.xml.tag | ||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
17 | ||
17.0 |
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,13 @@ | ||
version: "3.5" | ||
|
||
services: | ||
axonserver: | ||
image: axoniq/axonserver:2023.2.1-jdk-11 | ||
container_name: eventstore-transformations-axonserver | ||
ports: | ||
- "8024:8024" | ||
- "8124:8124" | ||
volumes: | ||
- .docker/config:/axonserver/config:ro | ||
- .docker/data:/axonserver/data | ||
- .docker/events:/axonserver/events |
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 was deleted.
Oops, something went wrong.
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,11 @@ | ||
package io.holixon.example.axon.event.transformation | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.runApplication | ||
|
||
fun main(args: Array<String>) { | ||
runApplication<SensorApplication>(*args).let { Unit } | ||
} | ||
|
||
@SpringBootApplication | ||
class SensorApplication |
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,35 @@ | ||
package io.holixon.example.axon.event.transformation.adapter.`in` | ||
|
||
import io.holixon.example.axon.event.transformation.application.port.`in`.Measurement | ||
import io.holixon.example.axon.event.transformation.application.port.`in`.SensorMeasurements | ||
import io.holixon.example.axon.event.transformation.application.port.`in`.UpdateMeasurementInPort | ||
import org.springframework.stereotype.Component | ||
import java.time.LocalDate | ||
import kotlin.random.Random | ||
|
||
@Component | ||
class BatchUpdater( | ||
val updateMeasurementInPort: UpdateMeasurementInPort | ||
) { | ||
|
||
fun runBatchUpdate(sensorId: String = "temp1") { | ||
(0L..365L).forEach { offset -> | ||
val updateDate = LocalDate.now().plusDays(offset) | ||
generateForecast(sensorId, updateDate) | ||
} | ||
} | ||
|
||
fun generateForecast(sensorId: String, updateDate: LocalDate) { | ||
updateMeasurementInPort.updateSensorMeasurements( | ||
SensorMeasurements( | ||
sensorId = sensorId, | ||
values = (0L..365L).associate { forecastOffset -> | ||
updateDate.plusDays(forecastOffset) to Measurement(randomFloat(), "°C") | ||
} | ||
) | ||
) | ||
|
||
} | ||
|
||
private fun randomFloat(): Float = Random.nextFloat() * 30 | ||
} |
Oops, something went wrong.