Skip to content

Commit

Permalink
delayed mass production trigger, see #106
Browse files Browse the repository at this point in the history
  • Loading branch information
zambrovski committed Jul 12, 2024
1 parent 4f80238 commit bfaaf05
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ import bankaccount.MassOperations
import mu.KLogging
import org.springframework.boot.context.event.ApplicationStartedEvent
import org.springframework.context.event.EventListener
import org.springframework.scheduling.annotation.EnableScheduling
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Component

@Component
@EnableScheduling
class LoadGeneratorOnStartTrigger(
private val massOperations: MassOperations
) {
companion object : KLogging()

@EventListener(ApplicationStartedEvent::class)
@Scheduled(initialDelay = 5_000, fixedDelay = 1_000_000_000)
fun createAccounts() {
massOperations.createAccounts(count = 10, numberOfTransfers = 100)
}
Expand Down
8 changes: 8 additions & 0 deletions lib/comparison-tests/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>

<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>

</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.holixon.axon.avro.serializer.converter

import io.toolisticon.kotlin.avro.AvroKotlin
import io.toolisticon.kotlin.avro.codec.GenericRecordCodec
import io.toolisticon.kotlin.avro.value.SingleObjectEncodedBytes
import mu.KLogging
import org.apache.avro.generic.GenericRecord
import org.axonframework.serialization.ContentTypeConverter

class GenericDataRecordToSingleObjectEncodedConverter : ContentTypeConverter<GenericRecord, SingleObjectEncodedBytes> {

companion object : KLogging()

override fun expectedSourceType(): Class<GenericRecord> = GenericRecord::class.java

override fun targetType(): Class<SingleObjectEncodedBytes> = SingleObjectEncodedBytes::class.java

override fun convert(original: GenericRecord): SingleObjectEncodedBytes {
// TODO: we (sh|c)ould make genericData/conversions configurable ... maybe.
logger.trace { "Generic record: $original" }
return GenericRecordCodec.encodeSingleObject(record = original, genericData = AvroKotlin.genericData)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>

<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>


<!--
<logger name="org.testcontainers" level="WARN"/>
<logger name="tc.axonserver" level="WARN"/>
<logger name="org.springframework.core.annotation.AnnotationTypeMapping" level="ERROR"/>
-->
</configuration>

This file was deleted.

0 comments on commit bfaaf05

Please sign in to comment.