Welcome! Log In Create A New Profile


[ANN] Nginx-Clojure v0.4.1 Release!

August 12, 2015 02:21PM
0.4.1 (2015-08-12)

New Feature: Coroutine based socket supports unix domain socket
New Feature: APIs for Embedding Nginx-Clojure into a standard Clojure/Java/Groovy App (issue #86). This feature makes debug/test with Nginx Clojure/Java/Groovy handlers very easy.
New Feature: Autodetect jvm_path (issue #85)
New Feature: Support to use annotation to mark a class or method to be suspenable in coroutine context (issue #84)
Enhancement: Auto send error when meets a non websocket request with auto_upgrade_wsis on
Enhancement: Add websocket-upgrade! to server channel API
Enhancement: Add WholeMessageAdapter to make handling small websocket messages easier.
Bug Fix: NginxHttpServerChannel.write(ByteBuffer buf) does not reset the buffer's position (issue #83)
Bug Fix: No access to tomcat server 8.24 from nginx-clojure (issue #82)
Binaries Distribution: Including some java sources for easy debug.
Build Script: Autodetect JNI header files

Below are some simple examples about embedding Nginx-Clojure and we can try them with lein repl or debug them in a Java IDE.

[nginx-clojure/nginx-clojure-embed "0.4.1"]

For Clojure

;;(1) Start it with ring handler and an options map
;;my-app can be a simple ring hanler or a compojure router.
(run-server my-app {:port 8080})

;;(2) Start it with a nginx.conf file
(run-server "/my-dir/nginx.conf")

;;(3) Start it with a given work dir
(binding [*nginx-work-dir* my-work-dir]
(run-server ...))

;;(4) Stop the server

For Java

//Start it with ring handler and an options map
NginxEmbedServer.getServer().start("my.HelloHandler", ArrayMap.create("port", "8081"));

//Start it with with a nginx.conf file

//Start it with a given work dir

//Stop the server
default options:

"error-log", "logs/error.log",
"max-connections", "1024",
"access-log", "off",
"keepalive-timeout", "65",
"max-threads", "8",
"host", "",
"port", "8080",

There 's an example about compojure routing and websocket example in the unit tests source :



Web Site http://nginx-clojure.github.io/
Source Hosted on Github https://github.com/nginx-clojure/nginx-clojure
Google Group (mailing list) https://groups.google.com/forum/#!forum/nginx-clojure
Subject Author Posted

[ANN] Nginx-Clojure v0.4.1 Release!

xfeep August 12, 2015 02:21PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 46
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready