Skip to content

Commit

Permalink
Review and move js-java-async-helidon demo to archive; Don't run CI w…
Browse files Browse the repository at this point in the history
…orkflow monthly
  • Loading branch information
olyagpl committed Dec 16, 2024
1 parent bcf2be7 commit da4d710
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
name: js-java-async-helidon
name: archive/js-java-async-helidon
on:
push:
paths:
- 'js-java-async-helidon/**'
- '.github/workflows/js-java-async-helidon.yml'
- 'archive/js-java-async-helidon/**'
- '.github/workflows/archive-js-java-async-helidon.yml'
pull_request:
paths:
- 'js-java-async-helidon/**'
- '.github/workflows/js-java-async-helidon.yml'
schedule:
- cron: "0 0 1 * *" # run every month
- 'archive/js-java-async-helidon/**'
- '.github/workflows/archive-js-java-async-helidon.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
run:
name: Run 'js-java-async-helidon'
name: Run 'archive/js-java-async-helidon'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -26,9 +24,9 @@ jobs:
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Run 'js-java-async-helidon'
- name: Run 'archive/js-java-async-helidon'
run: |
cd js-java-async-helidon
cd archive/js-java-async-helidon
mvn --no-transfer-progress clean package
mvn exec:exec &
sleep 10
Expand Down
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,6 @@ cd graalvm-demos
</tbody>
</table>

### Helidon

<table>
<thead>
<tr>
<th align="left">Name</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" width="30%"><a href="/js-java-async-helidon/">js-java-async-helidon</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/js-java-async-helidon.yml"><img alt="js-java-async-helidon" src="https://github.com/graalvm/graalvm-demos/actions/workflows/js-java-async-helidon.yml/badge.svg" /></a></td>
<td align="left" width="70%">An HTTP web service that demonstrates how multiple JavaScript contexts can be executed in parallel to handle asynchronous operations with Helidon in Java <br><strong>Technologies: </strong>Native Image, Helidon, Native Build Tools Maven plugin <br><strong>Reference: </strong><a href="https://medium.com/graalvm/asynchronous-polyglot-programming-in-graalvm-javascript-and-java-2c62eb02acf0">Asynchronous Polyglot Programming in GraalVM Using Helidon and JavaScript</a></td>
</tr>
</tbody>
</table>

### Scala

<table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,44 @@

This is a polyglot Helidon HTTP web service that demonstrates how multiple JavaScript `Context`s can be executed in parallel to handle asynchronous operations with [Helidon](https://helidon.io/), mixing JavaScript `Promise` and Java `CompletableFuture` objects.

## Prerequisites
* [GraalVM](http://graalvm.org)

## Preparation

1. Download and install the latest GraalVM JDK using [SDKMAN!](https://sdkman.io/).
```bash
sdk install java 21.0.1-graal
sdk install java 21.0.5-graal
```

2. Download or clone the repository and navigate into the `js-java-async-helidon` directory:
```bash
git clone https://github.com/graalvm/graalvm-demos
```
```bash
cd graalvm-demos/js-java-async-helidon
cd graalvm-demos/archive/js-java-async-helidon
```

3. Build the application using Maven:
```bash
mvn clean package
```

Now you are all set to run the polyglot Helidon Web service.
Now you are all set to run the polyglot Helidon web service.

## Running the Application

You can run this Helidon HTTP web service with the following command:
You can run this Helidon application with the following command:
```bash
mvn exec:exec
```

The application will create a new HTTP web service accepting requests on port `8080`.
The application accepts requests on port `8080`.
Open [http://localhost:8080/greet?request=42](http://localhost:8080/greet?request=42) in the browser to send a request.

To demonstrate error handling, the application will not accept requests with `request` smaller than `42`.
For example, the following requests will return an error message:
```bash
curl http://localhost:8080/greet?request=41
```
```bash
curl http://localhost:8080/greet?request=foo
```

Expand All @@ -56,3 +55,5 @@ wrk -c 100 -t 10 -d 100 http://localhost:8080/greet?request=42

This is a sample application that, for brevity, contains reasonably large snippets of code inside the strings.
This is not the best approach for structuring polyglot apps, but the easiest to show in a compact way.

Read more about asynchronous programming across multiple languages in this post [Asynchronous polyglot programming with Java and JavaScript on GraalVM](https://medium.com/graalvm/asynchronous-polyglot-programming-in-graalvm-javascript-and-java-2c62eb02acf0).
File renamed without changes.

0 comments on commit da4d710

Please sign in to comment.