vertx-china / Vertx Lang Clojure
Vert.x Clojure support
Stars: ✭ 50
Labels
Projects that are alternatives of or similar to Vertx Lang Clojure
Vertx Sql Client
High performance reactive SQL Client written in Java
Stars: ✭ 690 (+1280%)
Mutual labels: vertx
Java Vertx Web
OpenTracing instrumentation for Vert.x web package
Stars: ✭ 21 (-58%)
Mutual labels: vertx
Vertx Blueprint Microservice
Vert.x Blueprint Project - Micro-Shop microservice application
Stars: ✭ 663 (+1226%)
Mutual labels: vertx
Sample Vertx Microservices
Two applications in different branches illustrates how to create asynchronous microservices with Vert.x, Consul and MongoDB, and how to secure them with Vert.x OAuth2 module and Keycloak
Stars: ✭ 37 (-26%)
Mutual labels: vertx
Vertx Eventbus Java
A Vert.x EventBus client written in Java, works on Android
Stars: ✭ 20 (-60%)
Mutual labels: vertx
Vertx Guide For Java Devs
Vert.x 3 guide for Java developers
Stars: ✭ 500 (+900%)
Mutual labels: vertx
Atmosphere
Realtime Client Server Framework for the JVM, supporting WebSockets with Cross-Browser Fallbacks
Stars: ✭ 3,552 (+7004%)
Mutual labels: vertx
Vertx Jooq
A jOOQ-CodeGenerator to create vertx-ified DAOs and POJOs.
Stars: ✭ 299 (+498%)
Mutual labels: vertx
Mycat2
MySQL Proxy using Java NIO based on Sharding SQL,Calcite ,simple and fast
Stars: ✭ 750 (+1400%)
Mutual labels: vertx
Gushici
一言·古诗词 API (Hitokoto API),随机返回一条古诗词名句。采用 Vert.x + Redis 全异步开发,毫秒级稳定响应。
Stars: ✭ 975 (+1850%)
Mutual labels: vertx
Vertx React Example
Simple test of using Vert.x and React for server-side rendering
Stars: ✭ 11 (-78%)
Mutual labels: vertx
vertx-lang-clojure
Vert.x Clojure support
How to use?
Maven(in your pom.xml):
<dependency>
<groupId>com.w2v4</groupId>
<artifactId>vertx-lang-clojure</artifactId>
<version>3.5.1.1</version>
</dependency>
Gradle(in your build.gradle file):
dependencies {
compile 'com.w2v4:vertx-lang-clojure:3.5.1.1'
}
Hello from Vert.x!
(ns example.server
(:require [io.vertx.clojure.core.vertx :as vertx]
[io.vertx.clojure.core.http.http-server :as server]
[io.vertx.clojure.core.http.http-server-request :as request]
[io.vertx.clojure.core.http.http-server-response :as response]))
(defn handle-request [req]
(let [response (request/response req)]
(-> response
(response/put-header "content-type" "text/plain")
(response/end "Hello from Vert.x!"))))
(defn start [vertx]
(let [http-server (vertx/create-http-server vertx)]
(-> http-server
(server/request-handler (vertx/handler handle-request))
(server/listen 8080))))
Vert.x instance
If you’re embedding Vert.x then you simply create an instance as follows:
(ns ...
(:require [io.vertx.clojure.core.vertx :as vertx]))
;create a vertx instance
(vertx/vertx)
Verticle
Verticle namespace files normally include a start function which is the entry point of verticle deployment.
Here’s an example verticle:
;Called when verticle is deployed
(defn start [] )
;Optional - called when verticle is undeployed
(defn stop [] )
When Vert.x deploys the verticle it will call the start method, and when the method has completed the verticle will be considered started.
You can also optionally provide vertx and context parameters. This will be used by developers when the functions are considered pure.
;Following functions format are all allowed, pick one.
(defn start [context vertx] )
(defn start [vertx context] )
(defn start [vertx] )
(defn start [context] )
;Following functions format are all allowed, pick one.
(defn stop [context vertx] )
(defn stop [vertx context] )
(defn stop [vertx] )
(defn stop [context] )
Verticle Deployment
You could deploy a Clojure verticle with ".clj" suffix or "clj:" prefix:
(ns example.verticle
(:require [io.vertx.clojure.core.vertx :as vertx]))
(defn start [vertx]
(vertx/deploy-verticle vertx "io.vertx.sample_verticle.clj"))
;or
(defn start [vertx]
(vertx/deploy-verticle vertx "clj:io.vertx.sample_verticle"))
;TODO
- [x] Auto-generate thin wrap APIs by using Codegen
- [x] VerticleWrapper of generated APIs(ClojureVerticle for .clj suffix namespaces)
- [x] ClojureVerticleFactory service
- [x] Tests
- [ ] Auto-generate docs by using Docgen
- [ ] Using Codox to generate on-line Clojure documentation
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].