Skip to content

Commit 8e0f9bf

Browse files
committed
quarkus sample added
1 parent 5752293 commit 8e0f9bf

File tree

5 files changed

+169
-21
lines changed

5 files changed

+169
-21
lines changed

hiero-microprofile-sample/pom.xml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
7+
<parent>
8+
<groupId>com.open-elements.hiero</groupId>
9+
<artifactId>hiero-enterprise</artifactId>
10+
<version>0.14.0-SNAPSHOT</version>
11+
<relativePath>../pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>hiero-microprofile-sample</artifactId>
15+
16+
<name>Hiero Enterprise Microprofile Sample</name>
17+
<description>Sample for Hiero in Microprofile (by using Quarkus)</description>
18+
<url>https://github.com/OpenElements/hiero-enterprise-java</url>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>io.quarkus</groupId>
23+
<artifactId>quarkus-arc</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>io.quarkus</groupId>
27+
<artifactId>quarkus-rest</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>${project.groupId}</groupId>
31+
<artifactId>hiero-microprofile</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>io.grpc</groupId>
35+
<artifactId>grpc-okhttp</artifactId>
36+
</dependency>
37+
<dependency>
38+
<groupId>io.grpc</groupId>
39+
<artifactId>grpc-core</artifactId>
40+
</dependency>
41+
<dependency>
42+
<groupId>io.grpc</groupId>
43+
<artifactId>grpc-api</artifactId>
44+
</dependency>
45+
<dependency>
46+
<groupId>io.grpc</groupId>
47+
<artifactId>grpc-inprocess</artifactId>
48+
</dependency>
49+
</dependencies>
50+
51+
<build>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-deploy-plugin</artifactId>
56+
<configuration>
57+
<skip>true</skip>
58+
</configuration>
59+
</plugin>
60+
<plugin>
61+
<groupId>org.jreleaser</groupId>
62+
<artifactId>jreleaser-maven-plugin</artifactId>
63+
<configuration>
64+
<skip>true</skip>
65+
</configuration>
66+
</plugin>
67+
<plugin>
68+
<groupId>io.quarkus</groupId>
69+
<artifactId>quarkus-maven-plugin</artifactId>
70+
<version>${quarkus.version}</version>
71+
<extensions>true</extensions>
72+
<executions>
73+
<execution>
74+
<goals>
75+
<goal>build</goal>
76+
<goal>generate-code</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
</plugin>
81+
</plugins>
82+
</build>
83+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.openelements.hiero.microprofile.sample;
2+
3+
import com.openelements.hiero.base.AccountClient;
4+
import com.openelements.hiero.base.data.Account;
5+
import jakarta.inject.Inject;
6+
import jakarta.ws.rs.GET;
7+
import jakarta.ws.rs.Path;
8+
import jakarta.ws.rs.Produces;
9+
import jakarta.ws.rs.core.MediaType;
10+
11+
@Path("/")
12+
public class HieroEndpoint {
13+
14+
private final AccountClient client;
15+
16+
@Inject
17+
public HieroEndpoint(final AccountClient client) {
18+
this.client = client;
19+
}
20+
21+
@GET
22+
@Produces(MediaType.TEXT_PLAIN)
23+
public String createAccount() {
24+
try {
25+
final Account account = client.createAccount();
26+
return "Account created!";
27+
} catch (final Exception e) {
28+
throw new RuntimeException("Error in Hedera call", e);
29+
}
30+
}
31+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
hiero.accountId=SHOULD_BE_DEFINED_IN_ENV_FILE
2+
hiero.privateKey=SHOULD_BE_DEFINED_IN_ENV_FILE
3+
hiero.network.name=hedera-testnet
4+
quarkus.log.category."com.openelements".level=DEBUG

hiero-spring-sample/src/main/java/com/openelements/hiero/spring/sample/HieroEndpoint.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.openelements.hiero.spring.sample;
22

33
import com.openelements.hiero.base.AccountClient;
4+
import com.openelements.hiero.base.data.Account;
45
import java.util.Objects;
56
import org.springframework.web.bind.annotation.GetMapping;
67
import org.springframework.web.bind.annotation.RestController;
@@ -15,9 +16,10 @@ public HieroEndpoint(final AccountClient client) {
1516
}
1617

1718
@GetMapping("/")
18-
public String getBalance() {
19+
public String createAccount() {
1920
try {
20-
return client.getAccountBalance("0.0.100").toString();
21+
final Account account = client.createAccount();
22+
return "Account created!";
2123
} catch (final Exception e) {
2224
throw new RuntimeException("Error in Hedera call", e);
2325
}

pom.xml

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,24 @@
4545
<dotenv.version>3.0.0</dotenv.version>
4646
<junit.version>5.10.3</junit.version>
4747
<slf4j.version>2.0.13</slf4j.version>
48-
<helidon.version>3.2.10</helidon.version>
48+
<helidon.version>4.1.4</helidon.version>
49+
<helidon.test.version>3.2.11</helidon.test.version>
4950
<jakarta.enterprise.version>3.0.1</jakarta.enterprise.version>
5051
<microprofile.version>7.0</microprofile.version>
52+
<quarkus.version>3.17.2</quarkus.version>
53+
<jboss-logging.version>3.6.1.Final</jboss-logging.version>
54+
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
55+
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
56+
<maven-surefire-plugin.version>3.3.1</maven-surefire-plugin.version>
57+
<maven-javadoc-plugin.version>3.8.0</maven-javadoc-plugin.version>
58+
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
59+
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
60+
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
61+
<maven-deploy-plugin.version>3.1.2</maven-deploy-plugin.version>
62+
<maven-clean-plugin.version>3.4.0</maven-clean-plugin.version>
63+
<cyclonedx-maven-plugin.version>2.8.0</cyclonedx-maven-plugin.version>
64+
<jreleaser-maven-plugin.version>1.9.0</jreleaser-maven-plugin.version>
65+
<versions-maven-plugin.version>2.17.1</versions-maven-plugin.version>
5166
</properties>
5267

5368
<dependencyManagement>
@@ -66,6 +81,13 @@
6681
<scope>import</scope>
6782
<type>pom</type>
6883
</dependency>
84+
<dependency>
85+
<groupId>io.quarkus.platform</groupId>
86+
<artifactId>quarkus-bom</artifactId>
87+
<version>${quarkus.version}</version>
88+
<type>pom</type>
89+
<scope>import</scope>
90+
</dependency>
6991
<dependency>
7092
<groupId>${project.groupId}</groupId>
7193
<artifactId>hiero-base</artifactId>
@@ -107,6 +129,11 @@
107129
<artifactId>grpc-core</artifactId>
108130
<version>${grpc.version}</version>
109131
</dependency>
132+
<dependency>
133+
<groupId>io.grpc</groupId>
134+
<artifactId>grpc-api</artifactId>
135+
<version>${grpc.version}</version>
136+
</dependency>
110137
<dependency>
111138
<groupId>io.grpc</groupId>
112139
<artifactId>grpc-context</artifactId>
@@ -142,11 +169,6 @@
142169
<artifactId>slf4j-simple</artifactId>
143170
<version>${slf4j.version}</version>
144171
</dependency>
145-
<dependency>
146-
<groupId>jakarta.enterprise</groupId>
147-
<artifactId>jakarta.enterprise.cdi-api</artifactId>
148-
<version>${jakarta.enterprise.version}</version>
149-
</dependency>
150172
<dependency>
151173
<groupId>io.helidon.microprofile.server</groupId>
152174
<artifactId>helidon-microprofile-server</artifactId>
@@ -155,7 +177,12 @@
155177
<dependency>
156178
<groupId>io.helidon.microprofile.tests</groupId>
157179
<artifactId>helidon-microprofile-tests-junit5</artifactId>
158-
<version>${helidon.version}</version>
180+
<version>${helidon.test.version}</version>
181+
</dependency>
182+
<dependency>
183+
<groupId>org.jboss.logging</groupId>
184+
<artifactId>jboss-logging</artifactId>
185+
<version>${jboss-logging.version}</version>
159186
</dependency>
160187
</dependencies>
161188
</dependencyManagement>
@@ -165,6 +192,7 @@
165192
<module>hiero-spring</module>
166193
<module>hiero-microprofile</module>
167194
<module>hiero-spring-sample</module>
195+
<module>hiero-microprofile-sample</module>
168196
</modules>
169197

170198
<build>
@@ -173,62 +201,62 @@
173201
<plugin>
174202
<groupId>org.apache.maven.plugins</groupId>
175203
<artifactId>maven-resources-plugin</artifactId>
176-
<version>3.3.1</version>
204+
<version>${maven-resources-plugin.version}</version>
177205
</plugin>
178206
<plugin>
179207
<groupId>org.apache.maven.plugins</groupId>
180208
<artifactId>maven-compiler-plugin</artifactId>
181-
<version>3.13.0</version>
209+
<version>${maven-compiler-plugin.version}</version>
182210
</plugin>
183211
<plugin>
184212
<groupId>org.apache.maven.plugins</groupId>
185213
<artifactId>maven-surefire-plugin</artifactId>
186-
<version>3.3.1</version>
214+
<version>${maven-surefire-plugin.version}</version>
187215
</plugin>
188216
<plugin>
189217
<groupId>org.apache.maven.plugins</groupId>
190218
<artifactId>maven-javadoc-plugin</artifactId>
191-
<version>3.8.0</version>
219+
<version>${maven-javadoc-plugin.version}</version>
192220
</plugin>
193221
<plugin>
194222
<groupId>org.apache.maven.plugins</groupId>
195223
<artifactId>maven-source-plugin</artifactId>
196-
<version>3.3.1</version>
224+
<version>${maven-source-plugin.version}</version>
197225
</plugin>
198226
<plugin>
199227
<groupId>org.apache.maven.plugins</groupId>
200228
<artifactId>maven-gpg-plugin</artifactId>
201-
<version>3.2.4</version>
229+
<version>${maven-gpg-plugin.version}</version>
202230
</plugin>
203231
<plugin>
204232
<groupId>org.apache.maven.plugins</groupId>
205233
<artifactId>maven-jar-plugin</artifactId>
206-
<version>3.4.2</version>
234+
<version>${maven-jar-plugin.version}</version>
207235
</plugin>
208236
<plugin>
209237
<groupId>org.apache.maven.plugins</groupId>
210238
<artifactId>maven-deploy-plugin</artifactId>
211-
<version>3.1.2</version>
239+
<version>${maven-deploy-plugin.version}</version>
212240
</plugin>
213241
<plugin>
214242
<groupId>org.apache.maven.plugins</groupId>
215243
<artifactId>maven-clean-plugin</artifactId>
216-
<version>3.4.0</version>
244+
<version>${maven-clean-plugin.version}</version>
217245
</plugin>
218246
<plugin>
219247
<groupId>org.cyclonedx</groupId>
220248
<artifactId>cyclonedx-maven-plugin</artifactId>
221-
<version>2.8.0</version>
249+
<version>${cyclonedx-maven-plugin.version}</version>
222250
</plugin>
223251
<plugin>
224252
<groupId>org.jreleaser</groupId>
225253
<artifactId>jreleaser-maven-plugin</artifactId>
226-
<version>1.9.0</version>
254+
<version>${jreleaser-maven-plugin.version}</version>
227255
</plugin>
228256
<plugin>
229257
<groupId>org.codehaus.mojo</groupId>
230258
<artifactId>versions-maven-plugin</artifactId>
231-
<version>2.17.1</version>
259+
<version>${versions-maven-plugin.version}</version>
232260
</plugin>
233261
</plugins>
234262
</pluginManagement>

0 commit comments

Comments
 (0)