Skip to content

Commit 0f32c2a

Browse files
committed
wip
1 parent 1058d1a commit 0f32c2a

33 files changed

+521
-173
lines changed

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ dependencies {
9494
// TL signing library
9595
implementation group: 'com.truelayer', name: 'truelayer-signing', version: '0.2.6'
9696

97+
// OpenTelemetry
98+
implementation group: 'io.opentelemetry.instrumentation', name: 'opentelemetry-okhttp-3.0', version: '2.11.0-alpha'
99+
97100
// Serialization
98101
def jacksonVersion = '2.14.1'
99102
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: jacksonVersion

examples/quarkus-mvc/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@ nb-configuration.xml
3434

3535
# Local environment
3636
.env
37+
38+
# Plugin directory
39+
/.quarkus/cli/plugins/
40+
# TLS Certificates
41+
.certs/

examples/quarkus-mvc/README.md

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,62 @@
1-
# Quarkus MVC example project
1+
# quarkus-mvc
22

3-
A simple MVC project based on [Quarkus](https://quarkus.io), that comes with a UI to send donations and setup payment mandates
4-
via TrueLayer Payments API.
3+
This project uses Quarkus, the Supersonic Subatomic Java Framework.
54

6-
![home](./home.png)
5+
If you want to learn more about Quarkus, please visit its website: <https://quarkus.io/>.
76

7+
## Running the application in dev mode
88

9-
## Requirements
9+
You can run your application in dev mode that enables live coding using:
1010

11-
To run the project it is enough to have Java 11 installed with with `JAVA_HOME` environment variable configured appropriately;
11+
```shell script
12+
./gradlew quarkusDev
13+
```
1214

13-
## Configuration
15+
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at <http://localhost:8080/q/dev/>.
1416
15-
This sample project leverages [Quarkus configuration framework](https://quarkus.io/guides/config) to specify the client
16-
credentials and signing options required to initialise the TrueLayer client.
17+
## Packaging and running the application
1718

18-
In this sample application the client is configured for TrueLayer Sandbox environment. Make sure that you're
19-
using a proper set of Sandbox credentials or switch to your desired environment in [`TrueLayerClientProvider.java`](./src/main/java/com/truelayer/quarkusmvc/TrueLayerClientProvider.java#L33) class.
19+
The application can be packaged using:
2020

21-
The easiest way to setup the project with your credentials is to fill the [application.properties](./src/main/resources/application.properties) file or
22-
set the following environment variables:
23-
- `TL_CLIENT_ID`
24-
- `TL_CLIENT_SECRET`
25-
- `TL_SIGNING_KEY_ID`
26-
- `TL_SIGNING_PRIVATE_KEY_LOCATION`
27-
In addition, make sure to properly configure the redirect URI in the [DonationService.createDonationLink()](./src/main/java/com/truelayer/quarkusmvc/services/DonationService.java#L71) method, so that the value is one of the redirect URIs set as allowed in your Console Application:
28-
```java
29-
return tlClient.hpp().getHostedPaymentPageLink(paymentResponse.getData().getId(), paymentResponse.getData().getResourceToken(),
30-
URI.create("<redirect_url>"));
21+
```shell script
22+
./gradlew build
3123
```
3224

33-
Make sure to whitelist the `<redirect_url>` value in your TrueLayer console.
25+
It produces the `quarkus-run.jar` file in the `build/quarkus-app/` directory.
26+
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `build/quarkus-app/lib/` directory.
3427

35-
## Running the application
28+
The application is now runnable using `java -jar build/quarkus-app/quarkus-run.jar`.
3629

37-
To run the application, simply execute the following gradle task from the root directory of this sample project:
30+
If you want to build an _über-jar_, execute the following command:
3831

39-
```shell
40-
./gradlew quarkusDev
32+
```shell script
33+
./gradlew build -Dquarkus.package.jar.type=uber-jar
34+
```
35+
36+
The application, packaged as an _über-jar_, is now runnable using `java -jar build/*-runner.jar`.
37+
38+
## Creating a native executable
39+
40+
You can create a native executable using:
41+
42+
```shell script
43+
./gradlew build -Dquarkus.native.enabled=true
44+
```
45+
46+
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
47+
48+
```shell script
49+
./gradlew build -Dquarkus.native.enabled=true -Dquarkus.native.container-build=true
4150
```
4251

43-
Alternatively, you can load the project in your favorite IDE and rely on IDE plugins to boot the application.
52+
You can then execute your native executable with: `./build/quarkus-mvc-1.0.0-SNAPSHOT-runner`
53+
54+
If you want to learn more about building native executables, please consult <https://quarkus.io/guides/gradle-tooling>.
55+
56+
## Provided Code
57+
58+
### REST
4459

45-
## Testing the application
60+
Easily start your REST Web Services
4661

47-
Browse to http://localhost:8080/donations or http://localhost:8080/subscriptions
62+
[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources)

examples/quarkus-mvc/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'java'
33
id 'io.quarkus'
4-
id "io.freefair.lombok" version "6.6"
4+
id 'io.freefair.lombok' version '8.11'
55
}
66

77
repositories {
@@ -10,14 +10,13 @@ repositories {
1010
}
1111

1212
dependencies {
13-
implementation 'io.quarkus:quarkus-resteasy-jackson'
1413
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
1514
implementation 'io.quarkus:quarkus-arc'
1615
implementation 'io.quarkus:quarkus-qute'
1716
implementation 'io.quarkus:quarkus-resteasy-qute'
17+
implementation 'io.quarkus:quarkus-opentelemetry'
1818

19-
// TL Java BE library
20-
implementation 'com.truelayer:truelayer-java:4.0.0'
19+
implementation 'com.truelayer:truelayer-java'
2120

2221
testImplementation 'io.quarkus:quarkus-junit5'
2322
testImplementation 'io.rest-assured:rest-assured'
@@ -27,10 +26,13 @@ group 'com.truelayer'
2726
version '1.0.0-SNAPSHOT'
2827

2928
java {
30-
sourceCompatibility = JavaVersion.VERSION_11
31-
targetCompatibility = JavaVersion.VERSION_11
29+
sourceCompatibility = JavaVersion.VERSION_21
30+
targetCompatibility = JavaVersion.VERSION_21
3231
}
3332

33+
test {
34+
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
35+
}
3436
compileJava {
3537
options.encoding = 'UTF-8'
3638
options.compilerArgs << '-parameters'
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
receivers:
2+
otlp:
3+
protocols:
4+
grpc:
5+
endpoint: otel-collector:4317
6+
processors:
7+
attributes:
8+
actions:
9+
- key: test.key
10+
value: hello!
11+
action: insert
12+
batch:
13+
memory_limiter:
14+
check_interval: 1s
15+
limit_percentage: 75
16+
17+
exporters:
18+
debug:
19+
verbosity: detailed
20+
otlp:
21+
endpoint: jaeger:4317
22+
tls:
23+
insecure: true
24+
prometheus:
25+
endpoint: otel-collector:3000
26+
27+
extensions:
28+
health_check:
29+
zpages:
30+
endpoint: "otel-collector:55679"
31+
32+
service:
33+
extensions: [health_check, zpages]
34+
pipelines:
35+
traces:
36+
receivers: [otlp]
37+
processors: [batch, attributes, memory_limiter]
38+
exporters: [otlp]
39+
traces/2:
40+
receivers: [ otlp ]
41+
processors: [ batch, attributes, memory_limiter ]
42+
exporters: [ debug ]
43+
metrics:
44+
receivers: [otlp]
45+
processors: [batch, memory_limiter]
46+
exporters: [prometheus]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: quarkus-mvc
2+
3+
services:
4+
5+
# backend:
6+
# build: .
7+
# depends_on:
8+
# - db
9+
# ports:
10+
# - "8080:8080"
11+
12+
jaeger:
13+
image: jaegertracing/jaeger:2.1.0
14+
ports:
15+
- "16686:16686"
16+
17+
otel-collector:
18+
image: otel/opentelemetry-collector-contrib:0.116.1
19+
depends_on:
20+
- jaeger
21+
ports:
22+
- "4317:4317"
23+
- "4318:4318"
24+
- "55679:55679"
25+
- "3000:3000"
26+
volumes:
27+
- "./collector.yaml:/etc/otelcol-contrib/config.yaml"
28+
29+
prometheus:
30+
image: prom/prometheus:v3.0.1
31+
ports:
32+
- "9090:9090"
33+
volumes:
34+
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#Gradle properties
2-
#Thu Jan 20 18:17:05 CET 2022
3-
quarkusPluginVersion=2.6.3.Final
4-
quarkusPlatformArtifactId=quarkus-bom
1+
# Gradle properties
2+
53
quarkusPluginId=io.quarkus
4+
quarkusPluginVersion=3.17.5
65
quarkusPlatformGroupId=io.quarkus.platform
7-
quarkusPlatformVersion=2.6.3.Final
6+
quarkusPlatformArtifactId=quarkus-bom
7+
quarkusPlatformVersion=3.17.5
-15.6 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

examples/quarkus-mvc/gradlew

Lines changed: 31 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)