No description, website, or topics provided.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A Java implementation of SparkPi using Vert.x 3

This application is an example tutorial for the community. It is intended to be used as a source-to-image (s2i) application.

Quick start

You should have access to an OpenShift cluster and be logged in with the oc command line tool.

  1. Create the necessary infrastructure objects

    oc create -f
  2. Launch vertx-sparkpi

    oc new-app --template oshinko-java-spark-build-dc \
        -p APPLICATION_NAME=vertx-sparkpi \
        -p GIT_URI= \
        -p APP_FILE=sparkpi-app-1.0-SNAPSHOT-vertx.jar \
        -p SPARK_OPTIONS='--driver-java-options="-Dvertx.cacheDirBase=/tmp/vertx-cache"'
  3. Expose an external route

    oc expose svc/vertx-sparkpi
  4. Visit the exposed URL with your browser or other HTTP tool, for example:

    $ curl http://`oc get routes/vertx-sparkpi --template='{{}}'`
    Java Vert.x SparkPi server running. Add the 'sparkpi' route to this URL to invoke the app.
    $ curl http://`oc get routes/vertx-sparkpi --template='{{}}'`/sparkpi
    Pi is roughly 3.140480

Optional parameter

If you would like to change the number of samples that are used to calculate Pi, you can specify them by adding the scale argument to your request , for example:

$ curl http://`oc get routes/vertx-sparkpi --template='{{}}'`/sparkpi?scale=10
Pi is roughly 3.141749