Nginx-Clojure v0.4.1 Release!

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
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
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 S.
Source Hosted on Github GitHub - nginx-clojure/nginx-clojure: Nginx module for embedding Clojure or Java or Groovy programs, typically those Ring based handlers.
Google Group (mailing list)
Redirecting to Google Groups

Posted at Nginx Forum: