1 Star 0 Fork 0

wangyin/optaplanner-quickstarts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.adoc 4.66 KB
一键复制 编辑 原始数据 按行查看 历史

Vaccination scheduling (Java, Quarkus, Maven)

Assign people to vaccination injection appointments over time at vaccination centers to end a pandemic sooner.

quarkus vaccination scheduling screenshot

Run the application

  1. Git clone the optaplanner-quickstarts repo and navigate to this directory:

    $ git clone https://github.com/kiegroup/optaplanner-quickstarts.git
    ...
    $ cd optaplanner-quickstarts/use-cases/vaccination-scheduling
  2. Start the application with Maven:

    $ mvn quarkus:dev
  3. Visit http://localhost:8080 in your browser.

  4. Click on the Solve button.

Then try live coding:

  1. Make some changes in the source code.

  2. Refresh your browser (F5).

Notice that those changes are immediately in effect.

Run the packaged application

When you’re done iterating in quarkus:dev mode, package the application to run as a conventional jar file.

  1. Compile it with Maven:

    $ mvn package
  2. Run it:

    $ java -jar ./target/quarkus-app/quarkus-run.jar
    Note

    To run it on port 8081 instead, add -Dquarkus.http.port=8081.

  3. Visit http://localhost:8080 in your browser.

  4. Click on the Solve button.

Host it in the cloud

To allow others to try this application in their browser, host it in the cloud and share the url with them.

Host it on OpenShift (Kubernetes)

Red Hat OpenShift is an open source Kubernetes cloud service which is ideal to host OptaPlanner applications.

To deploy the application on OpenShift:

  1. Get a free Developer Sandbox account for OpenShift and launch the Developer Sandbox.

  2. In the OpenShift web console, verify that the top left combobox is set to Developer (not Administrator).

  3. In the menu, select Add to create an application.

  4. Under Git Repository, click Import from Git and fill in these parameters:

    1. Set Git Repo URL to https://github.com/kiegroup/optaplanner-quickstarts

    2. Under Show advanced Git options, set Context dir to /use-cases/vaccination-scheduling

    3. Press the Create button.

  5. In the Topology view, there is a new deployment:

    1. Wait a minute until the build completes (watch the bottom left icon until it turns green).

    2. Open the URL (click on the top right icon).

  6. Click on the Solve button.

Host it on OpenShift using native build

Requirements:

To deploy the application on OpenShift using the native build:

  1. Get a free Developer Sandbox account for OpenShift and launch the Developer Sandbox.

  2. In the OpenShift web console, verify that the top left combobox is set to Developer (not Administrator).

  3. In the OpenShift web console, click your username (in the upper right corner) and select the "Copy login command" option.

  4. In a bash terminal on your local machine, paste the login command.

  5. In a local clone of the repo, navigate to the use-cases/vaccination-scheduling directory.

  6. Run the command below:

    $ mvn clean package -DskipTests -Dopenshift-native -Dquarkus.kubernetes.deploy=true -Dquarkus.native.container-build=true
  7. When the command is finished, you should see one pod in the Topology view: the native Quarkus application. If you click the Quarkus' application link (small bubble with link icon at the top right of the Quarkus' application bubble), you will be navigated to the application. Alternatively, you can get the route from bash with the following command:

    $ oc get routes

Run it native

To increase startup performance for serverless deployments, build the application as a native executable:

  1. Install GraalVM and gu install the native-image tool

  2. Compile it natively. This takes a few minutes:

    $ mvn package -Dnative -DskipTests
  3. Run the native executable:

    $ ./target/*-runner
  4. Visit http://localhost:8080 in your browser.

  5. Click on the Solve button.

More information

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/java_wangyin/optaplanner-quickstarts.git
git@gitee.com:java_wangyin/optaplanner-quickstarts.git
java_wangyin
optaplanner-quickstarts
optaplanner-quickstarts
8.x

搜索帮助