{"id":1269,"date":"2018-12-02T06:01:01","date_gmt":"2018-12-02T06:01:01","guid":{"rendered":"https:\/\/www.javaadvent.com\/?p=1269"},"modified":"2018-12-01T16:53:02","modified_gmt":"2018-12-01T16:53:02","slug":"serverless-java-and-fn-project-first-steps","status":"publish","type":"post","link":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html","title":{"rendered":"Serverless, Java and FN Project, first steps"},"content":{"rendered":"<p>Serverless isn&#8217;t a new thing, but it is fair to say there is still a lot of hype about it and how it will change everything, and how in the future everything will be serverless. Beside serverless\/functions provided by cloud providers there are more and more serverless projects coming our way which goal is to break us from vendor lock-in and allow us to run serverless even on premise. Let us look at one such project FN Project.<\/p>\n<h3>What is FN Project<\/h3>\n<p>If we go to the official website of FN project <a href=\"http:\/\/fnproject.io\/\">http:\/\/fnproject.io\/<\/a> we can read something like this:<\/p>\n<p><em>&#8220;The Fn project is an open-source container-native serverless platform that you can run anywhere &#8212; any cloud or on-premise. It\u2019s easy to use, supports every programming language, and is extensible and performant.&#8221;<\/em><\/p>\n<p>FN Project is an open source project backed by Oracle, which base functions on containers. So, in theory, anything that can become container and can read and write from\/to stdin\/stdout, can become a function in FN project. This is a very nice feature, since it means, that in theory, it can support any programing language, unlike serverless\/functions provided by cloud providers, where if your language of choice wasn&#8217;t supported you couldn&#8217;t use it with serverless.<\/p>\n<p>Another nice feature of FN Project is that it can run on-premise, or in the cloud, or multiple clouds or in the combination of all mentioned.<\/p>\n<h3>Init setup<\/h3>\n<p>The only prerequisite for FN project is Docker 17.10.0-ce or later.<\/p>\n<p>To setup FN project, we need only to download FN binary<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/fnproject\/cli\/releases\">https:\/\/github.com\/fnproject\/cli\/releases<\/a><\/li>\n<\/ul>\n<p>and add it to the path. After this, we are ready to start playing with FN.<\/p>\n<h3>Initial function in FN project<\/h3>\n<p>The first thing that we need to do is to start FN server. In order to do so, we only need to type this in a terminal\/console<\/p>\n<pre>$ fn start<\/pre>\n<p>To validate that all is working good we can run this command<\/p>\n<pre>$ fn version<\/pre>\n<p>This will print version of fn server and fn client running on the machine. In the case of my laptop I get this values<\/p>\n<pre>$ fn version\n  Client version: 0.5.15\n  Server version: 0.3.595<\/pre>\n<p>Once we validated that all is good we can start to create our first function.<\/p>\n<h3>First function in FN Project<\/h3>\n<p>As mentioned FN project is <em>&#8220;language agnostic&#8221;<\/em>, in theory, it can support any language, but it doesn&#8217;t mean that it supports all languages at the moment. To see which languages are supported with the version we have we can run next command:<\/p>\n<pre>$ fn init --help<\/pre>\n<p>&nbsp;<\/p>\n<p>There is option <strong>&#8211;runtime<\/strong> which will list all options available on our machine. In my case, I will choose Java programing language. So to create the first function in Java we just need to run this command:<\/p>\n<pre>$ fn init --runtime java --trigger http function1<\/pre>\n<p><strong>function1<\/strong> is the name of the function, and here we put the name that we want to use. Option <strong>&#8211;trigger http<\/strong> means that we want to create HTTP trigger for our function which will allow us to call it over HTTP, for example via curl. After running this command fn will generate initial function for us and put it in the directory named as we named our function, in my case <strong>function1<\/strong>.<\/p>\n<p>Let us look at what is generated<\/p>\n<pre>$ cd function1\n$ find .\n\n.\/src\/main\/java\/com\/example\/fn\/HelloFunction.java\n.\/src\/test\/java\/com\/example\/fn\/HelloFunctionTest.java\n.\/pom.xml\n.\/func.yaml<\/pre>\n<p>If we open pom.xml file, it will look like any other pom.xml file. Only dependencies there for FN project will be dependencies for testing part, there are no dependencies for building or running our java fn function.<\/p>\n<p>If we open <strong>HelloFunction.java<\/strong>, we will again see that it is plain Java class, with ZERO dependencies.<\/p>\n<pre>package com.example.fn;\n\n    public class HelloFunction {\n\n    public String handleRequest(String input) {\n        String name = (input == null || input.isEmpty()) ? \n                                             \"world\" : input;\n\n        return \"Hello, \" + name + \"!\";\n    }\n}<\/pre>\n<p>There is only one method <strong>handleRequest<\/strong> that takes String as an input and provide String as an output. This is very different from writing functions in an implementation of cloud providers since they always add specific libraries or other types of dependencies in order for functions to work with their system. In case of FN since there are no dependencies it can run without any problem anywhere and you are not looked in into anything.<\/p>\n<h4>&#8220;Magic&#8221; of FN Project<\/h4>\n<p>So how does then FN works? How it knows how to run our function?<\/p>\n<p>All magic is in <strong>func.yaml<\/strong> file. Or to be more precise all configuration needed to create a function in FN project. Let us take a closer look at it.<\/p>\n<pre>$ cat func.yaml\n\nschema_version: 20180708\nname: function1\nversion: 0.0.1\nruntime: java\nbuild_image: fnproject\/fn-java-fdk-build:jdk9-1.0.75\nrun_image: fnproject\/fn-java-fdk:jdk9-1.0.75\ncmd: com.example.fn.HelloFunction::handleRequest\nformat: http-stream\ntriggers:\n- name: function1-trigger\ntype: http\nsource: \/function1-trigger<\/pre>\n<p>There are multiple fields here:<\/p>\n<ul>\n<li>schema_version is pointing out which version of Fn was used to generate this file<\/li>\n<li>name is the name of our function<\/li>\n<li>version is the current version of our function and as we deploy it will be autoincremented<\/li>\n<li>runtime language that we chose to write our function in<\/li>\n<li>build_image docker image used to build our function depends of course on the language of choice<\/li>\n<li>run_image docker image used to run our function<\/li>\n<li>cmd <em>entry point<\/em> to our function, what needs to be called to perform our business logic<\/li>\n<li>triggers here are defined triggers for invoking our function, in our case we have HTTP trigger<\/li>\n<\/ul>\n<h3>Unit tests in FN project<\/h3>\n<p>Maybe you noticed that one of the generated files is <strong>HelloFunctionTest.java<\/strong>, this file is indeed unit test file for our function, which is also autogenerated for us, and populated with a simple example of the unit test. Let us take a look at that file.<\/p>\n<pre>public class HelloFunctionTest {\n\n    @Rule\n    public final FnTestingRule testing =   \n                                FnTestingRule.createDefault();\n\n    @Test\n    public void shouldReturnGreeting() {\n        testing.givenEvent().enqueue();\n        testing.thenRun(HelloFunction.class, \"handleRequest\");\n\n        FnResult result = testing.getOnlyResult();\n        assertEquals(\"Hello, world!\",\n                     result.getBodyAsString());\n    }\n}<\/pre>\n<p>Except for some fn dependencies and part with <strong>@Rule<\/strong>, everything else looks like any other JUnit test in java. This unit test will just invoke our function without passing any parameters, and check if a result is &#8220;Hello world!&#8221;. The great thing about this test is that we can run it like any other unit test, we can invoke it from maven or IDE in any standard way.<\/p>\n<p>Let us now write the test where we will pass some arguments and validated that our function still works as expected. In order to do so, we can add this code to our test class<\/p>\n<pre>    @Test\n    public void shouldReturnGreetingwithBodyValue() {\n        testing.givenEvent().withBody(\"Java\").enqueue();\n        testing.thenRun(HelloFunction.class, \"handleRequest\");\n\n        FnResult result = testing.getOnlyResult();\n        assertEquals(\"Hello, Java!\",\n                     result.getBodyAsString());\n}<\/pre>\n<p>Again, we can run it like any other unit test and validate that all is good.<\/p>\n<h3>Deploying and Invoking FN function<\/h3>\n<p>Now that we defined our function, we understand what files are generated and what is their purpose, we also did unit testing. Then it is time for us to deploy and invoke the function. We can deploy our function to the cloud and docker registry, but it is much easier and faster to deploy it only locally especially while we are busy in development. To deploy function we just need to run this command<\/p>\n<pre>$ fn deploy --app myapp1 --local<\/pre>\n<p>Here we are telling fn to deploy our function into application <strong>myapp1<\/strong>, and to deploy it only locally by providing option <strong>&#8211;local<\/strong>. Once we successfully deployed our function, we can invoke it. To invoke it we can run next command<\/p>\n<pre>$ fn invoke myapp1 function1<\/pre>\n<p>We provide the name of our application and the name of our function. If we would like to provide input to our function we can do it in this way<\/p>\n<pre>$ echo \"Java is great\" | fn invoke myapp1 function1<\/pre>\n<p>If you remember we also created HTTP trigger, so let&#8217;s use it to invoke our function.<\/p>\n<pre>$ curl http:\/\/localhost:8080\/t\/myapp1\/function1-trigger<\/pre>\n<h3>FN function with JSON<\/h3>\n<p>We can already do a lot of nice things with this, but let us move to the next level, where we will use JSON as input and output of our FN functions. First, we need to create a simple POJO class, something like this<\/p>\n<pre>public class Hello {\n\n    private String message;\n\n    public String getMessage() {\n        return message;\n    }\n\n    public void setMessage(String message) {\n        this.message = message;\n    }\n}<\/pre>\n<p>now we can modify our function to take this class as input and output, so the function would look like this<\/p>\n<pre>public Hello handleRequest(Hello input) {\n    String name = (input == null || \n                     input.getMessage().isEmpty()) ? \"world\" :\n                                           input.getMessage();\n\n    Hello hello = new Hello();\n    hello.setMessage(message + \", \" + name + \"!\")\n\n    return hello;\n}<\/pre>\n<p>after we deploy function we can invoke it like this<\/p>\n<pre>$ curl -d '{\"message\":\"JSON Input\"}' \\\n              http:\/\/localhost:8080\/t\/myapp1\/function1-trigger\n\n<\/pre>\n<h3>References and future read<\/h3>\n<p>As we saw starting to develop functions with FN project is very easy and fun, also in the small amount of time we can create powerful functions.<\/p>\n<p>What we saw here is only part of possibilities of FN Project, for more info about FN in general and more info about possibilities I would suggest looking at websites listed below<\/p>\n<ul>\n<li><a href=\"http:\/\/fnproject.io\/\">http:\/\/fnproject.io\/<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/fnproject\/fn\">https:\/\/github.com\/fnproject\/fn<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/vladimir-dejanovic\/java-in-fn-project\">https:\/\/github.com\/vladimir-dejanovic\/java-in-fn-project<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Serverless isn&#8217;t a new thing, but it is fair to say there is still a lot of hype about it and how it will change everything, and how in the future everything will be serverless. Beside serverless\/functions provided by cloud providers there are more and more serverless projects coming our way which goal is to [&hellip;]<\/p>\n","protected":false},"author":46,"featured_media":1293,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[276],"tags":[],"coauthors":[],"class_list":["post-1269","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-276"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Serverless, Java and FN Project, first steps - JVM Advent<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Serverless, Java and FN Project, first steps - JVM Advent\" \/>\n<meta property=\"og:description\" content=\"Serverless isn&#8217;t a new thing, but it is fair to say there is still a lot of hype about it and how it will change everything, and how in the future everything will be serverless. Beside serverless\/functions provided by cloud providers there are more and more serverless projects coming our way which goal is to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html\" \/>\n<meta property=\"og:site_name\" content=\"JVM Advent\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Java-Advent-Calendar-229536173843473\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-02T06:01:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javaadvent.com\/content\/uploads\/2018\/11\/duke2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"280\" \/>\n\t<meta property=\"og:image:height\" content=\"280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vladimir Dejanovic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@twitter.com\/VladimirD_42\" \/>\n<meta name=\"twitter:site\" content=\"@javaadvent\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vladimir Dejanovic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html\"},\"author\":{\"name\":\"Vladimir Dejanovic\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#\\\/schema\\\/person\\\/84410358aeb9d73c99a3fa57f13a1a99\"},\"headline\":\"Serverless, Java and FN Project, first steps\",\"datePublished\":\"2018-12-02T06:01:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html\"},\"wordCount\":1321,\"commentCount\":3,\"image\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.javaadvent.com\\\/content\\\/uploads\\\/2018\\\/11\\\/duke2.png?fit=280%2C280&ssl=1\",\"articleSection\":[\"2017\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html\",\"url\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html\",\"name\":\"Serverless, Java and FN Project, first steps - JVM Advent\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.javaadvent.com\\\/content\\\/uploads\\\/2018\\\/11\\\/duke2.png?fit=280%2C280&ssl=1\",\"datePublished\":\"2018-12-02T06:01:01+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#\\\/schema\\\/person\\\/84410358aeb9d73c99a3fa57f13a1a99\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.javaadvent.com\\\/content\\\/uploads\\\/2018\\\/11\\\/duke2.png?fit=280%2C280&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.javaadvent.com\\\/content\\\/uploads\\\/2018\\\/11\\\/duke2.png?fit=280%2C280&ssl=1\",\"width\":280,\"height\":280},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2018\\\/12\\\/serverless-java-and-fn-project-first-steps.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javaadvent.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Serverless, Java and FN Project, first steps\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javaadvent.com\\\/\",\"name\":\"JVM Advent\",\"description\":\"The JVM Programming Advent Calendar\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javaadvent.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#\\\/schema\\\/person\\\/84410358aeb9d73c99a3fa57f13a1a99\",\"name\":\"Vladimir Dejanovic\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8ce4cf8a5d345a0ffe84348ae89428adca77e75f447dbe7de173a5033a571ab6?s=96&d=retro&r=g0573cf9e0356a7e54537a2653ae2eba6\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8ce4cf8a5d345a0ffe84348ae89428adca77e75f447dbe7de173a5033a571ab6?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8ce4cf8a5d345a0ffe84348ae89428adca77e75f447dbe7de173a5033a571ab6?s=96&d=retro&r=g\",\"caption\":\"Vladimir Dejanovic\"},\"description\":\"Founder and leader of AmsterdamJUG. JavaOne Rock Star, CodeOne Star speaker Storyteller Software Architect ,Team Lead and IT Consultant working in industry since 2006 developing high performance software in multiple programming languages and technologies from desktop to mobile and web with high load traffic. Enjoining developing software mostly in Java and JavaScript, however also wrote fair share of code in Scala, C++, C, PHP, Go, Objective-C, Python, R, Lisp and many others. Always interested in cool new stuff, Free and Open Source software. Like giving talks at conferences like JavaOne, Devoxx BE, Devoxx US, Devoxx PL, Devoxx MA, Java Day Istanbul, Java Day Minks, Voxxed Days Bristol, Voxxed Days Bucharest, Voxxed Days Belgrade, Voxxed Days Cluj-Napoca and others\",\"sameAs\":[\"http:\\\/\\\/www.itshark.xyz\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/vladimir-dejanovic\",\"https:\\\/\\\/x.com\\\/twitter.com\\\/VladimirD_42\"],\"url\":\"https:\\\/\\\/www.javaadvent.com\\\/author\\\/vladimirdejanovic\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Serverless, Java and FN Project, first steps - JVM Advent","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html","og_locale":"en_US","og_type":"article","og_title":"Serverless, Java and FN Project, first steps - JVM Advent","og_description":"Serverless isn&#8217;t a new thing, but it is fair to say there is still a lot of hype about it and how it will change everything, and how in the future everything will be serverless. Beside serverless\/functions provided by cloud providers there are more and more serverless projects coming our way which goal is to [&hellip;]","og_url":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html","og_site_name":"JVM Advent","article_publisher":"https:\/\/www.facebook.com\/Java-Advent-Calendar-229536173843473\/","article_published_time":"2018-12-02T06:01:01+00:00","og_image":[{"width":280,"height":280,"url":"https:\/\/www.javaadvent.com\/content\/uploads\/2018\/11\/duke2.png","type":"image\/png"}],"author":"Vladimir Dejanovic","twitter_card":"summary_large_image","twitter_creator":"@twitter.com\/VladimirD_42","twitter_site":"@javaadvent","twitter_misc":{"Written by":"Vladimir Dejanovic","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html#article","isPartOf":{"@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html"},"author":{"name":"Vladimir Dejanovic","@id":"https:\/\/www.javaadvent.com\/#\/schema\/person\/84410358aeb9d73c99a3fa57f13a1a99"},"headline":"Serverless, Java and FN Project, first steps","datePublished":"2018-12-02T06:01:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html"},"wordCount":1321,"commentCount":3,"image":{"@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2018\/11\/duke2.png?fit=280%2C280&ssl=1","articleSection":["2017"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html","url":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html","name":"Serverless, Java and FN Project, first steps - JVM Advent","isPartOf":{"@id":"https:\/\/www.javaadvent.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html#primaryimage"},"image":{"@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2018\/11\/duke2.png?fit=280%2C280&ssl=1","datePublished":"2018-12-02T06:01:01+00:00","author":{"@id":"https:\/\/www.javaadvent.com\/#\/schema\/person\/84410358aeb9d73c99a3fa57f13a1a99"},"breadcrumb":{"@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html#primaryimage","url":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2018\/11\/duke2.png?fit=280%2C280&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2018\/11\/duke2.png?fit=280%2C280&ssl=1","width":280,"height":280},{"@type":"BreadcrumbList","@id":"https:\/\/www.javaadvent.com\/2018\/12\/serverless-java-and-fn-project-first-steps.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javaadvent.com\/"},{"@type":"ListItem","position":2,"name":"Serverless, Java and FN Project, first steps"}]},{"@type":"WebSite","@id":"https:\/\/www.javaadvent.com\/#website","url":"https:\/\/www.javaadvent.com\/","name":"JVM Advent","description":"The JVM Programming Advent Calendar","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javaadvent.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.javaadvent.com\/#\/schema\/person\/84410358aeb9d73c99a3fa57f13a1a99","name":"Vladimir Dejanovic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8ce4cf8a5d345a0ffe84348ae89428adca77e75f447dbe7de173a5033a571ab6?s=96&d=retro&r=g0573cf9e0356a7e54537a2653ae2eba6","url":"https:\/\/secure.gravatar.com\/avatar\/8ce4cf8a5d345a0ffe84348ae89428adca77e75f447dbe7de173a5033a571ab6?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8ce4cf8a5d345a0ffe84348ae89428adca77e75f447dbe7de173a5033a571ab6?s=96&d=retro&r=g","caption":"Vladimir Dejanovic"},"description":"Founder and leader of AmsterdamJUG. JavaOne Rock Star, CodeOne Star speaker Storyteller Software Architect ,Team Lead and IT Consultant working in industry since 2006 developing high performance software in multiple programming languages and technologies from desktop to mobile and web with high load traffic. Enjoining developing software mostly in Java and JavaScript, however also wrote fair share of code in Scala, C++, C, PHP, Go, Objective-C, Python, R, Lisp and many others. Always interested in cool new stuff, Free and Open Source software. Like giving talks at conferences like JavaOne, Devoxx BE, Devoxx US, Devoxx PL, Devoxx MA, Java Day Istanbul, Java Day Minks, Voxxed Days Bristol, Voxxed Days Bucharest, Voxxed Days Belgrade, Voxxed Days Cluj-Napoca and others","sameAs":["http:\/\/www.itshark.xyz\/","https:\/\/www.linkedin.com\/in\/vladimir-dejanovic","https:\/\/x.com\/twitter.com\/VladimirD_42"],"url":"https:\/\/www.javaadvent.com\/author\/vladimirdejanovic"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2018\/11\/duke2.png?fit=280%2C280&ssl=1","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":5451,"url":"https:\/\/www.javaadvent.com\/2024\/12\/portable-serverless-functions-with-java-and-quarkus.html","url_meta":{"origin":1269,"position":0},"title":"Portable Serverless Functions with Java (and Quarkus)","author":"Kevin Dubois","date":"December 20, 2024","format":false,"excerpt":"You have probably already heard of serverless functions. If you've played around with them, it might have been on a platform like AWS Lambda, Azure Functions, Google Cloud Functions or similar. The vendors behind these platforms offer solutions specifically for Java as well. The libraries and deployment methodologies are typically\u2026","rel":"","context":"In &quot;2017&quot;","block_context":{"text":"2017","link":"https:\/\/www.javaadvent.com\/category\/2017"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-20.png?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-20.png?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-20.png?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-20.png?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3090,"url":"https:\/\/www.javaadvent.com\/2021\/12\/different-approaches-to-building-stateful-microservices-in-the-cloud-native-world.html","url_meta":{"origin":1269,"position":1},"title":"Different Approaches to building Stateful Microservices in the Cloud Native World","author":"Mary Grygleski","date":"December 23, 2021","format":false,"excerpt":"Cloud Native computing is all about working with stateless data and serverless systems. But we all live in a stateful world, in which data flows through systems inter-connected with one another through complex networks. So how can systems be able to manage and track the flow of data in a\u2026","rel":"","context":"In &quot;2021&quot;","block_context":{"text":"2021","link":"https:\/\/www.javaadvent.com\/category\/2021"},"img":{"alt_text":"valley near snowy mountain during daytime","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/11\/pexels-photo-164170.jpeg?fit=1200%2C510&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/11\/pexels-photo-164170.jpeg?fit=1200%2C510&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/11\/pexels-photo-164170.jpeg?fit=1200%2C510&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/11\/pexels-photo-164170.jpeg?fit=1200%2C510&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/11\/pexels-photo-164170.jpeg?fit=1200%2C510&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4118,"url":"https:\/\/www.javaadvent.com\/2022\/12\/components-of-cloud-native-java.html","url_meta":{"origin":1269,"position":2},"title":"Components of Cloud Native Java","author":"Alexander Gruev","date":"December 15, 2022","format":false,"excerpt":"WHAT IS CLOUD NATIVE JAVA\u00a0 Cloud native is a software approach to building, deploying and managing modern applications in cloud computing environments.\u00a0 It allows companies to build highly scalable and resilient applications that can easily be enhanced to meet customer needs without breaking existing functionality. The cloud native approach involves\u2026","rel":"","context":"In &quot;2022&quot;","block_context":{"text":"2022","link":"https:\/\/www.javaadvent.com\/category\/jvm-advent-2022"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-15.png?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-15.png?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-15.png?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-15.png?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3880,"url":"https:\/\/www.javaadvent.com\/2022\/12\/actors-and-virtual-threads-a-match-made-in-heaven.html","url_meta":{"origin":1269,"position":3},"title":"Actors and Virtual Threads, a match made in heaven?","author":"Andrea Peruffo","date":"December 11, 2022","format":false,"excerpt":"Introduction This blog builds on top of the great articles by Edoardo Vacchi leveraging all the goodies of a Typed Actor API and the working example of a Chat. Now that Java 19 has been released this use-case is a perfect test bed to use the advanced capabilities of the\u2026","rel":"","context":"In &quot;2022&quot;","block_context":{"text":"2022","link":"https:\/\/www.javaadvent.com\/category\/jvm-advent-2022"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-11.png?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-11.png?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-11.png?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-11.png?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":5083,"url":"https:\/\/www.javaadvent.com\/2024\/12\/wasm-4-the-java-geek-3-electric-boogaloo.html","url_meta":{"origin":1269,"position":4},"title":"Wasm 4 the Java Geek 3: Electric Boogaloo","author":"Edoardo Vacchi","date":"December 18, 2024","format":false,"excerpt":"\u00a0 And here we are again. For the third time in a row, we are back to the Java Advent, eager to discover what\u2019s new with WebAssembly from a Java developer perspective. Incidentally, since, as you know, I have a favorite topic (after programming languages and compilers, of course), it\u2026","rel":"","context":"In &quot;2024&quot;","block_context":{"text":"2024","link":"https:\/\/www.javaadvent.com\/category\/2024"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2024\/12\/wasm-4-java-geek-3.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2024\/12\/wasm-4-java-geek-3.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2024\/12\/wasm-4-java-geek-3.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2024\/12\/wasm-4-java-geek-3.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2024\/12\/wasm-4-java-geek-3.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3611,"url":"https:\/\/www.javaadvent.com\/2022\/12\/webassembly-for-the-java-geek.html","url_meta":{"origin":1269,"position":5},"title":"WebAssembly for the Java Geek","author":"Edoardo Vacchi","date":"December 23, 2022","format":false,"excerpt":"When many Java developers hear the word WebAssembly, the first thing they think is \u201cbrowser technology\u201d. The second thing: \u201cit\u2019s the JVM all over again\u201d. After all, for a Java developer, in-browser apps are prehistory.","rel":"","context":"In &quot;2022&quot;","block_context":{"text":"2022","link":"https:\/\/www.javaadvent.com\/category\/jvm-advent-2022"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-23.png?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-23.png?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-23.png?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-23.png?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]}],"jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/posts\/1269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/users\/46"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/comments?post=1269"}],"version-history":[{"count":2,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/posts\/1269\/revisions"}],"predecessor-version":[{"id":1294,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/posts\/1269\/revisions\/1294"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/media\/1293"}],"wp:attachment":[{"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/media?parent=1269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/categories?post=1269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/tags?post=1269"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/coauthors?post=1269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}