-
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.
Move event code to separate modules.
- Loading branch information
Showing
19 changed files
with
81 additions
and
52 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,13 @@ | ||
plugins { | ||
`java-library` | ||
kotlin("jvm") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
// Kotlin | ||
implementation(kotlin("stdlib-jdk8")) | ||
} |
3 changes: 3 additions & 0 deletions
3
checklister-event/src/main/kotlin/cloud/cosmin/checklister/lib/event/Event.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,3 @@ | ||
package cloud.cosmin.checklister.lib.event | ||
|
||
interface Event |
7 changes: 7 additions & 0 deletions
7
...er-event/src/main/kotlin/cloud/cosmin/checklister/lib/event/serializer/EventSerializer.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,7 @@ | ||
package cloud.cosmin.checklister.lib.event.serializer | ||
|
||
import cloud.cosmin.checklister.lib.event.Event | ||
|
||
interface EventSerializer { | ||
fun serialize(event: Event): ByteArray | ||
} |
9 changes: 9 additions & 0 deletions
9
.../src/main/kotlin/cloud/cosmin/checklister/lib/event/serializer/ToStringEventSerializer.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,9 @@ | ||
package cloud.cosmin.checklister.lib.event.serializer | ||
|
||
import cloud.cosmin.checklister.lib.event.Event | ||
|
||
class ToStringEventSerializer : EventSerializer { | ||
override fun serialize(event: Event): ByteArray { | ||
return event.toString().toByteArray() | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
checklister-event/src/main/kotlin/cloud/cosmin/checklister/lib/event/sink/EventSink.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,7 @@ | ||
package cloud.cosmin.checklister.lib.event.sink | ||
|
||
import cloud.cosmin.checklister.lib.event.Event | ||
|
||
interface EventSink { | ||
fun accept(event: Event) | ||
} |
14 changes: 14 additions & 0 deletions
14
...k-logger/src/main/kotlin/cloud/cosmin/checklister/lib/eventsink/logger/LoggerEventSink.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,14 @@ | ||
package cloud.cosmin.checklister.lib.eventsink.logger | ||
|
||
import cloud.cosmin.checklister.lib.event.Event | ||
import cloud.cosmin.checklister.lib.event.serializer.EventSerializer | ||
import cloud.cosmin.checklister.lib.event.sink.EventSink | ||
import org.apache.logging.log4j.Logger | ||
|
||
class LoggerEventSink(private val serializer: EventSerializer, | ||
private val log: Logger) : EventSink { | ||
override fun accept(event: Event) { | ||
val bytes = serializer.serialize(event) | ||
log.info("Event: {}", String(bytes)) | ||
} | ||
} |
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,2 @@ | ||
rootProject.name = "checklister" | ||
rootProject.name = "checklister" | ||
include("checklister-event", "checklister-eventsink-logger") |
14 changes: 13 additions & 1 deletion
14
src/main/kotlin/cloud/cosmin/checklister/ChecklisterApplication.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
5 changes: 0 additions & 5 deletions
5
src/main/kotlin/cloud/cosmin/checklister/service/event/Event.kt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/kotlin/cloud/cosmin/checklister/service/event/EventSerializer.kt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/kotlin/cloud/cosmin/checklister/service/event/EventSink.kt
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
1 change: 1 addition & 0 deletions
1
src/main/kotlin/cloud/cosmin/checklister/service/event/ItemEventService.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
src/main/kotlin/cloud/cosmin/checklister/service/event/ListEventService.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
7 changes: 0 additions & 7 deletions
7
src/main/kotlin/cloud/cosmin/checklister/service/event/ToStringEventSerializer.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
src/main/kotlin/cloud/cosmin/checklister/service/event/eventsink/LoggerEventSink.kt
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
1 change: 1 addition & 0 deletions
1
src/test/kotlin/cloud/cosmin/checklister/service/event/ItemEventServiceTest.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