Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use versionless features #145

Open
wants to merge 6 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
canSkip: ${{ steps.Checker.outputs.canSkip }}
steps:
- name: Get files
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get tools
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: tools/
repository: openliberty/guides-common
Expand Down Expand Up @@ -47,10 +47,11 @@ jobs:
run:
working-directory: finish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'semeru'
java-version: 17
- run: unset _JAVA_OPTIONS
- name: Run tests
Expand Down
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022, 2024 IBM Corporation and others.
// Copyright (c) 2022, 2025 IBM Corporation and others.
// Licensed under Creative Commons Attribution-NoDerivatives
// 4.0 International (CC BY-ND 4.0)
// https://creativecommons.org/licenses/by-nd/4.0/
Expand Down Expand Up @@ -40,7 +40,7 @@ The application that you will build in this guide consists of the `client` servi

image::architecture.png[Application architecture where system and client services use the Jakarta Websocket API to connect and communicate.,align="center"]

You'll learn how to use the link:https://openliberty.io/docs/latest/reference/javadoc/liberty-jakartaee9.1-javadoc.html?package=jakarta/websocket/package-frame.html&class=overview-summary.html[Jakarta WebSocket API^] to build the `system` service and the scheduler in the `client` service. The scheduler pushes messages to the system service every 10 seconds, then the system service broadcasts the messages to any connected clients. You will also learn how to use a JavaScript `WebSocket` object in an HTML file to build a WebSocket connection, subscribe to different events, and display the broadcasting messages from the `system` service in a table.
You'll learn how to use the link:https://openliberty.io/docs/latest/reference/javadoc/liberty-jakartaee10-javadoc.html?path=liberty-jakartaee10-javadoc/jakarta/websocket/package-summary.html[Jakarta WebSocket API^] to build the `system` service and the scheduler in the `client` service. The scheduler pushes messages to the system service every 10 seconds, then the system service broadcasts the messages to any connected clients. You will also learn how to use a JavaScript `WebSocket` object in an HTML file to build a WebSocket connection, subscribe to different events, and display the broadcasting messages from the `system` service in a table.

// =================================================================================================
// Getting started
Expand Down Expand Up @@ -229,7 +229,7 @@ SystemLoadScheduler.java
include::finish/client/src/main/java/io/openliberty/guides/client/scheduler/SystemLoadScheduler.java[]
----

The `SystemLoadScheduler` class uses the [hotspot=systemClient file=1]`SystemClient` class to establish a connection to the server by the `ws://localhost:9081/systemLoad` URI at the [hotspot=postConstruct file=1]`@PostConstruct` annotated method. The [hotspot=sendSystemLoad file=1]`sendSystemLoad()` method calls the client to send a random string from either [hotspot=messages file=1]`cpuLoad`, [hotspot=messages file=1]`memoryUsage`, or [hotspot=messages file=1]`both` to the `system` service. Using the link:https://openliberty.io/docs/latest/reference/javadoc/liberty-jakartaee9.1-javadoc.html?package=jakarta/ejb/package-frame.html&class=jakarta/ejb/TimerService.html[Jakarta Enterprise Beans Timer Service^], annotate the `sendSystemLoad()` method with the [hotspot=schedule file=1]`@Schedule` annotation so that it sends out a message every 10 seconds.
The `SystemLoadScheduler` class uses the [hotspot=systemClient file=1]`SystemClient` class to establish a connection to the server by the `ws://localhost:9081/systemLoad` URI at the [hotspot=postConstruct file=1]`@PostConstruct` annotated method. The [hotspot=sendSystemLoad file=1]`sendSystemLoad()` method calls the client to send a random string from either [hotspot=messages file=1]`cpuLoad`, [hotspot=messages file=1]`memoryUsage`, or [hotspot=messages file=1]`both` to the `system` service. Using the link:https://openliberty.io/docs/latest/reference/javadoc/liberty-jakartaee10-javadoc.html?path=liberty-jakartaee10-javadoc/jakarta/ejb/Schedule.html[Jakarta Enterprise Beans Schedule^], annotate the `sendSystemLoad()` method with the [hotspot=schedule file=1]`@Schedule` annotation so that it sends out a message every 10 seconds.

Now, create the front-end UI. The images and styles for the UI are provided for you.

Expand Down
7 changes: 4 additions & 3 deletions finish/client/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<server description="client service">

<featureManager>
<platform>jakartaee-10.0</platform>
<!-- tag::features[] -->
<feature>restfulWS-3.1</feature>
<feature>websocket-2.1</feature>
<feature>enterpriseBeansLite-4.0</feature>
<feature>restfulWS</feature>
<feature>websocket</feature>
<feature>enterpriseBeansLite</feature>
<!-- end::features[] -->
</featureManager>

Expand Down
5 changes: 3 additions & 2 deletions finish/system/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<server description="system Service">

<featureManager>
<platform>jakartaee-10.0</platform>
<!-- tag::webSocket[] -->
<feature>websocket-2.1</feature>
<feature>websocket</feature>
<!-- end::webSocket[] -->
<!-- tag::jsonB[] -->
<feature>jsonb-3.0</feature>
<feature>jsonb</feature>
<!-- end::jsonB[] -->
</featureManager>

Expand Down
7 changes: 4 additions & 3 deletions start/client/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<server description="client service">

<featureManager>
<platform>jakartaee-10.0</platform>
<!-- tag::features[] -->
<feature>restfulWS-3.1</feature>
<feature>websocket-2.1</feature>
<feature>enterpriseBeansLite-4.0</feature>
<feature>restfulWS</feature>
<feature>websocket</feature>
<feature>enterpriseBeansLite</feature>
<!-- end::features[] -->
</featureManager>

Expand Down
5 changes: 3 additions & 2 deletions start/system/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<server description="system Service">

<featureManager>
<platform>jakartaee-10.0</platform>
<!-- tag::webSocket[] -->
<feature>websocket-2.1</feature>
<feature>websocket</feature>
<!-- end::webSocket[] -->
<!-- tag::jsonB[] -->
<feature>jsonb-3.0</feature>
<feature>jsonb</feature>
<!-- end::jsonB[] -->
</featureManager>

Expand Down
Loading