Skip to content

Commit 4f2cc36

Browse files
committed
Minimized build.gradle and application.yaml, adopted readme
1 parent d6b9e2a commit 4f2cc36

File tree

4 files changed

+18
-53
lines changed

4 files changed

+18
-53
lines changed

Readme.adoc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,17 @@ It:
1111
- Accepts all visitor onboarding offers
1212
- Greets a visitor when the dialog is open
1313
- Echos all visitor messages
14-
- Logs all messages, not just in a bot dialog (the webhook handler is set up to do so)
14+
- Logs all messages, not just in a bot dialog (the webhook handler is set up to do so)
15+
16+
== Get it running
17+
Adopt `application.yaml` or populate environment variables (e.g. in a .env file):
18+
19+
[source,env]
20+
----
21+
UNBLU_HOST=https://some-installation.unblu.com
22+
UNBLU_USER=some-unblu-admin-user
23+
UNBLU_PASSWORD=hello-im-some-unblu-admin-user-password
24+
MIDDLEWARE_URL=https://where.my.middleware.is.running
25+
WEBHOOK_SECRET=a-very-secret-key
26+
BOT_SECRET=another-very-secret-key
27+
----

build.gradle

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@ plugins {
33
id 'application'
44
id 'org.springframework.boot' version '3.4.4'
55
id 'io.spring.dependency-management' version '1.1.6'
6-
id 'com.google.cloud.tools.jib' version '3.4.4'
76
}
87

98
mainClassName = 'com.unblu.middleware.test.App'
109
group 'com.unblu'
1110
version '1.0.0-SNAPSHOT'
1211

13-
wrapper {
14-
gradleVersion = '8.13'
15-
}
16-
1712
java {
1813
toolchain {
1914
languageVersion = JavaLanguageVersion.of(21)
@@ -30,51 +25,9 @@ wrapper {
3025
}
3126

3227
dependencies {
33-
implementation 'org.springframework.boot:spring-boot-starter-actuator'
3428
implementation 'org.springframework.boot:spring-boot-starter-webflux'
35-
implementation 'org.springframework:spring-messaging'
36-
implementation 'io.micrometer:context-propagation'
29+
implementation 'com.unblu.middleware:unblu-middleware-lib:1.5.5'
30+
implementation 'com.unblu.openapi:jersey3-client-v4:8.24.0'
3731
implementation 'org.projectlombok:lombok:1.18.34'
38-
implementation 'com.google.guava:guava:32.1.2-jre'
39-
implementation 'com.unblu.middleware:unblu-middleware-lib:1.5.1'
40-
41-
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
42-
43-
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
44-
45-
implementation 'com.unblu.openapi:jersey3-client-v4:8.18.0'
46-
47-
compileOnly 'org.projectlombok:lombok:1.18.34'
4832
annotationProcessor 'org.projectlombok:lombok:1.18.34'
49-
50-
// various
51-
implementation 'commons-codec:commons-codec'
52-
implementation 'io.projectreactor.addons:reactor-extra'
53-
54-
// (unit) testing
55-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
56-
testImplementation 'io.projectreactor:reactor-test'
57-
58-
testImplementation 'org.junit.jupiter:junit-jupiter-api'
59-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
60-
testAnnotationProcessor "org.projectlombok:lombok:1.18.34"
61-
}
62-
63-
test {
64-
// use this to see the output of tests (e.g. Spring dependency problems)
65-
// testLogging.showStandardStreams = true
66-
}
67-
68-
tasks.named('test') {
69-
useJUnitPlatform()
7033
}
71-
72-
tasks.named('bootRun') {
73-
if (project.hasProperty('spring.profiles.active')) {
74-
systemProperties = ['spring.profiles.active': project.getProperty('spring.profiles.active')]
75-
} else {
76-
systemProperties = ['spring.profiles.active': 'dev'] // Set default to 'dev'
77-
}
78-
}
79-
80-

src/main/java/com/unblu/middleware/test/TestMiddlewareService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ public void run(ApplicationArguments args) {
4242

4343
// echo every message back to the user
4444
dialogBotService.onDialogMessage(r ->
45-
Mono.fromRunnable(() -> echoIfSentByHuman(r)));
45+
Mono.fromRunnable(() -> echoIfSentByVisitor(r)));
4646

4747
// log every message sent anywhere using a webhook handler
4848
webhookHandlerService.onWebhook(eventName("conversation.new_message"), ConversationNewMessageEvent.class,
4949
e -> Mono.fromRunnable(() -> log.info("Message received: {}", e.getConversationMessage().getFallbackText())),
5050
canIgnoreOrder());
5151
}
5252

53-
private void echoIfSentByHuman(BotDialogMessageRequest r) {
53+
private void echoIfSentByVisitor(BotDialogMessageRequest r) {
5454
if (r.getConversationMessage().getSenderPerson().getPersonType() == EPersonType.VISITOR) {
5555
sendMessage(r.getDialogToken(), "You wrote: " + r.getConversationMessage().getFallbackText());
5656
}

src/main/resources/application.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ unblu:
55
middleware:
66
url: ${MIDDLEWARE_URL}
77
name: Test middleware
8-
autoSubscribe: true
98
bot:
109
secret: ${BOT_SECRET}
1110
onboardingFilter: VISITORS

0 commit comments

Comments
 (0)