Skip to content

Commit 2dc4018

Browse files
committed
prepared eventmodeling benchmarking, added idempotency key
1 parent f7e574c commit 2dc4018

File tree

34 files changed

+1879
-44
lines changed

34 files changed

+1879
-44
lines changed

docker-compose.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: '3.8'
2+
3+
services:
4+
prometheus:
5+
image: prom/prometheus
6+
ports:
7+
- "9090:9090"
8+
volumes:
9+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
10+
command:
11+
- '--config.file=/etc/prometheus/prometheus.yml'
12+
extra_hosts:
13+
- "host.docker.internal:host-gateway" # Required in Linux
14+
15+
loki:
16+
image: grafana/loki:2.9.3
17+
ports:
18+
- "3100:3100"
19+
command: -config.file=/etc/loki/local-config.yaml
20+
volumes:
21+
- loki-data:/loki
22+
23+
grafana:
24+
image: grafana/grafana
25+
ports:
26+
- "3000:3000"
27+
environment:
28+
- GF_AUTH_ANONYMOUS_ENABLED=true
29+
- GF_SECURITY_ADMIN_PASSWORD=admin
30+
depends_on:
31+
- prometheus
32+
# volumes:
33+
# - grafana-data:/var/lib/grafana
34+
35+
volumes:
36+
loki-data:
37+
# grafana-data:

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<properties>
3535
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3636

37-
<sliceworkz.eventstore.version>0.5.1</sliceworkz.eventstore.version>
37+
<sliceworkz.eventstore.version>0.5.2</sliceworkz.eventstore.version>
3838

3939
<maven.minimal-version>3.6.3</maven.minimal-version>
4040

@@ -55,6 +55,7 @@
5555
<module>sliceworkz-eventmodeling-testing</module>
5656
<module>sliceworkz-eventmodeling-tests-inmem</module>
5757
<module>sliceworkz-eventmodeling-tests-postgres</module>
58+
<module>sliceworkz-eventmodeling-benchmark</module>
5859
<module>sliceworkz-eventmodeling-examples</module>
5960
</modules>
6061

prometheus.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
global:
2+
scrape_interval: 15s
3+
evaluation_interval: 15s
4+
5+
scrape_configs:
6+
- job_name: 'sliceworkz-demo'
7+
metrics_path: '/metrics'
8+
static_configs:
9+
- targets: ['host.docker.internal:7072']

sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/automation/TodoListReadModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
import java.util.stream.Stream;
2121

2222
import org.sliceworkz.eventmodeling.readmodels.ReadModel;
23+
import org.sliceworkz.eventstore.query.Limit;
2324

2425
public interface TodoListReadModel<EVENT_TYPE, TODO_ITEM_TYPE> extends ReadModel<EVENT_TYPE> {
2526

26-
Stream<TODO_ITEM_TYPE> streamItems ( );
27+
Stream<TODO_ITEM_TYPE> streamItems ( Limit limit );
2728

2829
}

sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/commands/CommandResult.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ public interface CommandResult<DOMAIN_EVENT_TYPE, PRODUCED_EVENT_TYPE> {
2323

2424
public CommandResult<DOMAIN_EVENT_TYPE, PRODUCED_EVENT_TYPE> raiseEvent ( PRODUCED_EVENT_TYPE event, Tags tags );
2525

26+
public CommandResult<DOMAIN_EVENT_TYPE, PRODUCED_EVENT_TYPE> raiseEvent ( PRODUCED_EVENT_TYPE event, Tags tags, String idempotencyKey );
27+
2628
}

sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/inbound/TranslationCapability.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818
package org.sliceworkz.eventmodeling.inbound;
1919

2020
import org.sliceworkz.eventmodeling.events.Tracing;
21-
import org.sliceworkz.eventstore.events.Tag;
2221

2322
public interface TranslationCapability<INBOUND_EVENT_TYPE> {
2423

2524
void incoming ( INBOUND_EVENT_TYPE event );
2625

2726
void incoming ( INBOUND_EVENT_TYPE event, Tracing tracing );
2827

29-
void incoming ( INBOUND_EVENT_TYPE event, Tag idempotencyTag );
28+
void incoming ( INBOUND_EVENT_TYPE event, String idempotencyKey );
3029

31-
void incoming ( INBOUND_EVENT_TYPE event, Tag idempotencyTag, Tracing tracing );
30+
void incoming ( INBOUND_EVENT_TYPE event, String idempotencyKey, Tracing tracing );
3231

3332
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Sliceworkz Event Modeling - an opinionated Event Modeling framework in Java
5+
Copyright © 2025 Sliceworkz / XTi ([email protected])
6+
7+
This program is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU Lesser General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public License
18+
along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
20+
-->
21+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<parent>
24+
<groupId>org.sliceworkz</groupId>
25+
<artifactId>sliceworkz-eventmodeling-parent-pom</artifactId>
26+
<version>0.2.0-SNAPSHOT</version>
27+
<relativePath>../sliceworkz-eventmodeling-parent-pom</relativePath>
28+
</parent>
29+
<name>${project.artifactId}</name>
30+
<description>An opinionated Event Modeling framework in Java</description>
31+
<url>https://sliceworkz.github.io/eventmodeling</url>
32+
33+
<artifactId>sliceworkz-eventmodeling-benchmark</artifactId>
34+
<packaging>jar</packaging>
35+
36+
<properties>
37+
<javalin.version>6.7.0</javalin.version>
38+
<logback.version>1.5.21</logback.version>
39+
<loki-logback.version>2.0.1</loki-logback.version>
40+
</properties>
41+
42+
<dependencies>
43+
<dependency>
44+
<groupId>org.sliceworkz</groupId>
45+
<artifactId>sliceworkz-eventmodeling-impl</artifactId>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.sliceworkz</groupId>
49+
<artifactId>sliceworkz-eventstore-infra-inmem</artifactId>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.sliceworkz</groupId>
53+
<artifactId>sliceworkz-eventstore-infra-postgres</artifactId>
54+
</dependency>
55+
56+
<dependency>
57+
<groupId>ch.qos.logback</groupId>
58+
<artifactId>logback-classic</artifactId>
59+
<version>${logback.version}</version>
60+
</dependency>
61+
<dependency>
62+
<groupId>com.github.loki4j</groupId>
63+
<artifactId>loki-logback-appender</artifactId>
64+
<version>${loki-logback.version}</version>
65+
</dependency>
66+
67+
<dependency>
68+
<groupId>org.postgresql</groupId>
69+
<artifactId>postgresql</artifactId>
70+
<scope>compile</scope>
71+
</dependency>
72+
73+
<!-- REST API via Javalin -->
74+
<dependency>
75+
<groupId>io.javalin</groupId>
76+
<artifactId>javalin</artifactId>
77+
<version>${javalin.version}</version>
78+
</dependency>
79+
80+
<dependency>
81+
<groupId>io.micrometer</groupId>
82+
<artifactId>micrometer-core</artifactId>
83+
</dependency>
84+
85+
<!-- Micrometer Prometheus registry -->
86+
<dependency>
87+
<groupId>io.micrometer</groupId>
88+
<artifactId>micrometer-registry-prometheus</artifactId>
89+
<version>${micrometer.version}</version>
90+
</dependency>
91+
92+
</dependencies>
93+
94+
<build>
95+
<plugins>
96+
<plugin>
97+
<groupId>org.apache.maven.plugins</groupId>
98+
<artifactId>maven-shade-plugin</artifactId>
99+
<version>3.6.1</version>
100+
<executions>
101+
<execution>
102+
<phase>package</phase>
103+
<goals>
104+
<goal>shade</goal>
105+
</goals>
106+
<configuration>
107+
<filters>
108+
<filter>
109+
<artifact>*:*</artifact>
110+
<excludes>
111+
<exclude>META-INF/versions/*/module-info.class</exclude>
112+
<exclude>module-info.class</exclude>
113+
</excludes>
114+
</filter>
115+
<filter>
116+
<artifact>*:*</artifact>
117+
<excludes>
118+
<exclude>META-INF/MANIFEST.MF</exclude>
119+
</excludes>
120+
</filter>
121+
</filters>
122+
<transformers>
123+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
124+
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
125+
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
126+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
127+
<mainClass>org.sliceworkz.eventmodeling.benchmark.BenchmarkApplication</mainClass>
128+
</transformer>
129+
</transformers>
130+
</configuration>
131+
</execution>
132+
</executions>
133+
</plugin>
134+
</plugins>
135+
</build>
136+
137+
</project>

0 commit comments

Comments
 (0)