Skip to content

Commit

Permalink
Merge pull request #159 from OpenLiberty/staging
Browse files Browse the repository at this point in the history
Merge staging to prod: Update to MP61 and JEE10
  • Loading branch information
gkwan-ibm authored Apr 3, 2024
2 parents 109614d + 24a7669 commit e0ad595
Show file tree
Hide file tree
Showing 85 changed files with 1,762 additions and 1,084 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/finish"
schedule:
interval: monthly
open-pull-requests-limit: 50
- package-ecosystem: maven
directory: "/start"
schedule:
interval: monthly
open-pull-requests-limit: 50
39 changes: 33 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019, 2023 IBM Corporation and others.
// Copyright (c) 2019, 2024 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 All @@ -9,13 +9,14 @@
:page-layout: guide-multipane
:page-duration: 15 minutes
:page-releasedate: 2019-09-13
:page-majorupdateddate: 2024-04-04
:page-guide-category: microprofile
:page-essential: false
:page-description: Learn how to use MicroProfile Rest Client to invoke RESTful microservices asynchronously over HTTP.
:page-seo-title: Consuming RESTful Java microservices asynchronously using Eclipse MicroProfile Rest Client
:page-seo-description: A getting started tutorial and an example on how to consume RESTful Java microservices with asynchronous method calls using the CompletionStage interface and MicroProfile Rest Client.
:guide-author: Open Liberty
:page-tags: ['MicroProfile']
:page-tags: ['microprofile']
:page-permalink: /guides/{projectid}
:page-related-guides: ['microprofile-reactive-messaging', 'reactive-rest-client']
:common-includes: https://raw.githubusercontent.com/OpenLiberty/guides-common/prod
Expand Down Expand Up @@ -149,7 +150,7 @@ docker build -t inventory:1.0-SNAPSHOT inventory/.
docker build -t query:1.0-SNAPSHOT query/.
```

Next, use the provided `startContainers` script to start the application in Docker containers. The script creates containers for Kafka, Zookeeper, and all of the microservices in the project, in addition to a network for the containers to communicate with each other. The script also creates three instances of the `system` microservice.
Next, use the provided `startContainers` script to start the application in Docker containers. The script creates containers for Kafka and all of the microservices in the project, in addition to a network for the containers to communicate with each other. The script also creates three instances of the `system` microservice.

include::{common-includes}/os-tabs.adoc[]

Expand All @@ -171,12 +172,19 @@ include::{common-includes}/os-tabs.adoc[]

// static guide instructions:
ifndef::cloud-hosted[]
The services take some time to become available. You can access the application by making requests to the `query/systemLoad` endpoint by going to the http://localhost:9080/query/systemLoad[http://localhost:9080/query/systemLoad^] URL.
The services take some time to become available. Visit the http://localhost:9085/health[^] URL to confirm that the `inventory` microservice is up and running.

You can access the application by making requests to the `query/systemLoad` endpoint by going to the http://localhost:9080/query/systemLoad[http://localhost:9080/query/systemLoad^] URL.
endif::[]

// cloud-hosted guide instructions:
ifdef::cloud-hosted[]
The services might take several minutes to become available. You can access the application by making requests to the ***query/systemLoad*** endpoint by running the following curl command:
The services might take several minutes to become available. Run the following curl command to confirm that the ***inventory*** microservice is up and running.
```bash
curl -s http://localhost:9085/health | jq
```

You can access the application by making requests to the ***query/systemLoad*** endpoint by running the following curl command:
```bash
curl -s http://localhost:9080/query/systemLoad | jq
```
Expand Down Expand Up @@ -252,10 +260,26 @@ include::finish/query/src/test/java/it/io/openliberty/guides/query/QueryServiceI
ifndef::cloud-hosted[]
Navigate to the `query` directory, then verify that the tests pass by using the Maven `verify` goal:

include::{common-includes}/os-tabs.adoc[]

[.tab_content.windows_section]
--
[role='command']
```bash
```
mvn verify
```
--

[.tab_content.mac_section.linux_section]
--
[role='command']
```
export TESTCONTAINERS_RYUK_DISABLED=true
mvn verify
```

For more information about disabling Ryuk, see the https://java.testcontainers.org/features/configuration/#disabling-ryuk[Testcontainers custom configuration^] document.
--

When the tests succeed, you see output similar to the following example:
endif::[]
Expand All @@ -264,10 +288,13 @@ endif::[]
ifdef::cloud-hosted[]
Run the following commands to navigate to the ***query*** directory and verify that the tests pass by using the Maven ***verify*** goal:
```bash
export TESTCONTAINERS_RYUK_DISABLED=true
cd /home/project/guide-microprofile-rest-client-async/start/query
mvn verify
```

For more information about disabling Ryuk, see the [Testcontainers custom configuratio](https://java.testcontainers.org/features/configuration/#disabling-ryuk) document.

The tests might take a few minutes to complete. When the tests succeed, you see output similar to the following example:
endif::[]

Expand Down
76 changes: 53 additions & 23 deletions finish/inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@
<packaging>war</packaging>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Liberty configuration -->
<liberty.var.default.http.port>9085</liberty.var.default.http.port>
<liberty.var.default.https.port>9448</liberty.var.default.https.port>
<liberty.var.http.port>9085</liberty.var.http.port>
<liberty.var.https.port>9448</liberty.var.https.port>
</properties>

<dependencies>
<!-- Provided dependencies -->
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.enterprise.concurrent</groupId>
<artifactId>javax.enterprise.concurrent-api</artifactId>
<version>1.1</version>
<groupId>jakarta.enterprise.concurrent</groupId>
<artifactId>jakarta.enterprise.concurrent-api</artifactId>
<version>3.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>3.3</version>
<version>6.1</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<!-- tag::reactiveMessaging[] -->
<dependency>
<groupId>org.eclipse.microprofile.reactive.messaging</groupId>
<artifactId>microprofile-reactive-messaging-api</artifactId>
<version>1.0</version>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<!-- end::reactiveMessaging[] -->
Expand All @@ -57,33 +57,55 @@
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.8.1</version>
<version>3.7.0</version>
</dependency>
<!-- end::kafka[] -->
<!-- tag::rxjava[] -->
<dependency>
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
<version>3.1.2</version>
<version>3.1.8</version>
</dependency>
<!-- end::rxjava[] -->
<!-- For tests -->
<dependency>
<groupId>org.microshed</groupId>
<artifactId>microshed-testing-liberty</artifactId>
<version>0.9.1</version>
<scope>test</scope>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.12</version>
</dependency>
<!-- For tests -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<version>1.16.2</version>
<version>1.19.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0</version>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.19.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>6.2.8.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-binding-provider</artifactId>
<version>6.2.8.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -94,7 +116,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.0</version>
<configuration>
<packagingExcludes>pom.xml</packagingExcludes>
</configuration>
Expand All @@ -104,21 +126,29 @@
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.8.2</version>
<version>3.10.2</version>
<configuration>
<!-- devc config -->
<containerRunOpts>
-e WLP_LOGGING_CONSOLE_LOGLEVEL=info
-p 9085:9085
--network=reactive-app
</containerRunOpts>
</configuration>
</plugin>

<!-- Plugin to run unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.2.5</version>
</plugin>

<!-- Plugin to run integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<version>3.2.5</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2020 IBM Corporation and others.
* Copyright (c) 2020, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* http://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* IBM Corporation - Initial implementation
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
// end::copyright[]
package io.openliberty.guides.inventory;

import javax.ws.rs.core.Application;
import javax.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.ApplicationPath;

@ApplicationPath("/")
public class InventoryApplication extends Application {

}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2020 IBM Corporation and others.
* Copyright (c) 2020, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* http://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* IBM Corporation - Initial implementation
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
// end::copyright[]
package io.openliberty.guides.inventory;
Expand All @@ -20,12 +19,13 @@
import java.util.Properties;
import java.util.TreeMap;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class InventoryManager {

private Map<String, Properties> systems = Collections.synchronizedMap(new TreeMap<String, Properties>());

private Map<String, Properties> systems = Collections.synchronizedMap(
new TreeMap<String, Properties>());

public void addSystem(String hostname, Double systemLoad) {
if (!systems.containsKey(hostname)) {
Expand All @@ -39,8 +39,9 @@ public void addSystem(String hostname, Double systemLoad) {
public void updateCpuStatus(String hostname, Double systemLoad) {
Optional<Properties> p = getSystem(hostname);
if (p.isPresent()) {
if (p.get().getProperty(hostname) == null && hostname != null)
if (p.get().getProperty(hostname) == null && hostname != null) {
p.get().put("systemLoad", systemLoad);
}
}
}

Expand All @@ -56,4 +57,4 @@ public List<String> getSystems() {
public void resetSystems() {
systems.clear();
}
}
}
Loading

0 comments on commit e0ad595

Please sign in to comment.