{"id":13808009,"url":"https://github.com/advantageous/vertx-node-ec2-eventbus-example","last_synced_at":"2025-08-22T19:23:09.060Z","repository":{"id":77191495,"uuid":"49668889","full_name":"advantageous/vertx-node-ec2-eventbus-example","owner":"advantageous","description":"PoC for using Vert.x in EC2. Using the event bus bridge to Node. Setting up clustering in EC2. Possibly more. ","archived":false,"fork":false,"pushed_at":"2016-03-14T20:46:29.000Z","size":3794,"stargazers_count":45,"open_issues_count":2,"forks_count":7,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-11-19T00:44:16.927Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/advantageous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-01-14T19:12:20.000Z","updated_at":"2020-03-08T00:09:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"46a0ba58-1800-4264-9c1d-3a71ff5cca0d","html_url":"https://github.com/advantageous/vertx-node-ec2-eventbus-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fvertx-node-ec2-eventbus-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fvertx-node-ec2-eventbus-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fvertx-node-ec2-eventbus-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fvertx-node-ec2-eventbus-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/advantageous","download_url":"https://codeload.github.com/advantageous/vertx-node-ec2-eventbus-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225795302,"owners_count":17525317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:01:33.660Z","updated_at":"2024-11-21T20:13:05.634Z","avatar_url":"https://github.com/advantageous.png","language":"Java","funding_links":[],"categories":["Examples"],"sub_categories":[],"readme":"\n# Purpose\n\nThe purpose of this example is to show how to connect [Node](https://nodejs.org/en/) and [Vert.x](http://vertx.io/) \nwith the [Vert.x EventBus](http://vertx.io/docs/vertx-core/java/#event_bus) using the \n[Vert.x event bus bridge](http://vertx.io/docs/vertx-tcp-eventbus-bridge/java/). We will use Java on \n[Kotlin](https://kotlinlang.org/) \nin this example. We also plan on using Vert.x built-in clustering and discovery in ***EC2***, which means we will need\nto configure [Hazelcast](https://hazelcast.com/) to work in EC2. We plan on using [gradle](http://gradle.org/) \nfor the build. \n\nNote: Don't delete the branches. There are steps in there that correspond to Wiki pages.\n\nAnother feature of Vert.x 3 that we want to use is [Service Proxies](http://vertx.io/docs/vertx-service-proxy/) \nand [Service Factories](http://vertx.io/docs/vertx-service-factory/). This should allow us to create client stubs in \nJS which will allows us to make async call services written in ***Vert.x/Java/Kotlin*** from ***JavaScript/Node*** \n(or for that matter ***JRuby***, ***Ruby***, ***Jython***, ***Python***, etc.) via the event bus and event bus bridge.\n\nBased on research, this should be possible. Some of the research were slides in talks we saw on youtube.com \nand Vert.x docs.\nWe have worked with ***Vert.x*** and the ***EventBus*** before. \n\n\u003e The previous section has shown how you can create a service proxy in Java. \n\u003e However, you can consume your service directly from your browser or from a node.js application using \n\u003e a SockJS-based proxy. --Vert.x docs\n\nWe may have to break this up in small steps.\n\n#### Calling a proxy from JS in a browser from Vert.x docs\n```\n\u003cscript src=\"http://cdn.sockjs.org/sockjs-0.3.4.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"vertx-eventbus.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var eb = new EventBus('http://localhost:8080/eventbus');\n  eb.onopen = function() {\n    var SomeDatabaseService =\n      require('vertx-database-js/some_database_service-proxy.js');\n    var svc = new SomeDatabaseService(eb, \"database-service-address\");\n  };\n\u003c/script\u003e\n```\n\n\nArguments to services must be basic types and [data objects](https://github.com/vert-x3/vertx-codegen).\nData objects are fairly easy to create see above link. \n\n#### From Vert.x docs allowed types in services\n```\nParameters\nJSON\n\nPRIMITIVE\n\nList\u003cJSON\u003e\n\nList\u003cPRIMITIVE\u003e\n\nSet\u003cJSON\u003e\n\nSet\u003cPRIMITIVE\u003e\n\nMap\u003cString, JSON\u003e\n\nMap\u003cString, PRIMITIVE\u003e\n\nAny Enum type\n\nAny class annotated with @DataObject\n\nReturn type\nJSON\n\nPRIMITIVE\n\nList\u003cJSON\u003e\n\nList\u003cPRIMITIVE\u003e\n\nSet\u003cJSON\u003e\n\nSet\u003cPRIMITIVE\u003e\n\nAny Enum type\n\nAny class annotated with @DataObject\n\nAnother proxy\n```\n\n## Why Kotlin?\nWe picked Kotlin because it is strongly typed, compiles fast and has great Java integration. \nIt provides many of the things we love about Scala but in a more Java compatible way. At a minimum we will use Kotlin\ndata classes. Kotlin is also similar to Swift ([Swift is Kotlin](http://blog.translusion.com/posts/swift-is-kotlin/)).\nKotlin syntax is also a lot closer to JavaScript than Java, but still strongly typed and able to take full advantage of\nthe JDK and Java libs. Kotlin has constructs found in Swift and Scala, and is very approachable. \n\n## Why Vert.x?\nVert.x is reactive and fast. It has a lot of integration with monitoring, service discovery, and reactive streaming.\nIt also allows more flexibility in how we manage our IO/Threads, i.e., pure reactive or multi-reactive.\nThe idea is to write microservices in Node and Vert.x\n\n## Why Node?\nA lot of companies use Node and we often find ourselves integrating with Node application. \n\n## Why Gradle?\nIt is less verbose than Maven and more programmable. It is easier to hack. \n\n\n    \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvantageous%2Fvertx-node-ec2-eventbus-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadvantageous%2Fvertx-node-ec2-eventbus-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvantageous%2Fvertx-node-ec2-eventbus-example/lists"}