Switch branches/tags
0.2.1-versionupdates FunctionVersioning VersioningProposal add-python-test add-upgrade-guide-from-0.4-to-0.5 add-version-to-binary annotations_proposal async-requests autoscaling build-and-push-logger builder-builds builder-image bump-nats-limits cache_obj_type checkCRDcreationError cliAutoComplete close-idle-connectio common-version controller-tpr-compatible-types controller-tpr debug-only deprecate-fn-pods docs-provider-docker env-args-ci-test errorMessageForFailedCanary execution_strategy executor_abstraction extensions_proposal fetcher_retry fission-spec fission-workflows-0.2.0 fix-932 fix-998 fix-binary-environment-build-failure fix-components-crash-before-crds-creation fix-executor-cleanup-process fix-fluentd fix-function-not-update-problem fix-log-ordering fix-nd fix-post-install-job-failure fix-secret-cfgmap-update-problem fix-test_env_vars-failure fix_executor_panic fixFissionCore fluentd-configmap fluentd-workflows-2 fn_pods_removal gcpug-demo gevent-environment-ci-build glide_up_ci go-build-helper go-build-script-example go-builder go-env-fixes-457 golang-image-versions handle-multiple-http-methods hook-bugfixes idle-conn-timeout install-instructions-use-gh-releases issue/37 istio-integration java_env_design jvm-env-prototype jvm-specs jvm_heap jvm_issue jvm_readme k6-benchmark kafka_tests mac_tests master migrate-donet-project-json nd_pkg_update_issue-taching newdeploy_backend nodejsv2-test poolsize_env_fix pr371-copy prithvi-logging-branch promethus-fission-metrics pull-image-from-private-registry py-flask-bug python-env-variants record refactor-roundtrip resource-version-monitor retry-for-network-error router_caching_podip secret-cfgmap-branch secret-cfgmap-doc set-idle-conn-timeout show-warning-when-creating-route-with-non-existent-function skaffold_dev_workflow spec-flags spec_helm_removal swagger-api-spec temp_buildtime_reduction temp_test_disable test-connect test-logging-timestamps test_failure_investigation test_improvement tracing-places update-docs-problem upgrade_test_ci upstream/fix-test_env_vars-failure use-separate-controller-loop-to-watch-functions-changes v0.5.0-changelog-patch-1 v0.5.0 v0.6.0 v0.6.1 v0.7.0 v0.7.1 v0.8.0 v0.9.0 v0.9.1 v0.11.0 v0.12.0 v2-types-and-tpr wait-for-components-before-testing wait-for-pods-before-testing windows-instructions xiekeyang/pr713
Nothing to show
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
specs Specs for JVM example (#825) Nov 14, 2018
src Java env alpha (#656) Jun 27, 2018
.gitignore Java env alpha (#656) Jun 27, 2018
README.md Fixed the name of JVM builder image name (#824) Jul 27, 2018
build.sh Java env builder with Maven (#783) Jul 24, 2018
pom.xml Java env alpha (#656) Jun 27, 2018

README.md

Hello World in JVM/Java on Fission

The io.fission.HelloWorld.java class is a a very simple fission function that implements io.fission.Function and says "Hello, World!" .

Building and deploying using Fission

Fission's builder can be used to create the binary artifact from source code. Create an environment with builder image and then create a package.

$ zip -r java-src-pkg.zip *
$ fission env create --name java --image fission/jvm-env --version 2 --keeparchive --builder fission/jvm-builder
$ fission package create --sourcearchive java-src-pkg.zip --env java
java-src-pkg-zip-tvd0
$ fission package info --name java-src-pkg-zip-tvd0
Name:        java-src-pkg-zip-tvd0
Environment: java
Status:      succeeded
Build Logs:
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< io.fission:hello-world >-----------------------
[INFO] Building hello-world 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------

Once package's status is succeeded then that package can be used to create and execute a function.

$ fission fn create --name hello --pkg java-src-pkg-zip-tvd0 --env java --entrypoint io.fission.HelloWorld
$ fission fn test --name hello
Hello World!

Building locally and deploying with Fission

You can build the jar file in one of the two ways below based on your setup:

  • You can use docker without the need to install JDK and Maven to build the jar file from source code:
$ ./build.sh
  • If you have JDK and Maven installed, you can directly build the JAR file using command:
$ mvn clean package

Both of above steps will generate a target subdirectory which has the archive target/hello-world-1.0-SNAPSHOT-jar-with-dependencies.jar which will be used for creating function.

  • The archive created above will be used as a deploy package when creating the function.
$ fission env create --name jvm --image fission/jvm-env --version 2 --keeparchive=true
$ fission fn create --name hello --deploy target/hello-world-1.0-SNAPSHOT-jar-with-dependencies.jar --env jvm --entrypoint io.fission.HelloWorld
$ fission route create --function hello --url /hellop --method GET
$ fission fn test --name hello
Hello World!