# Nginx-Clojure v0.4.1 Release!

**URL:** <https://www.ruby-forum.com/t/nginx-clojure-v0-4-1-release/242986>\
**Category:** NGINX\
**Created:** [August 12, 2015, 8:21pm UTC](https://www.ruby-forum.com/t/nginx-clojure-v0-4-1-release/242986 "2015-08-12T20:21:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [August 12, 2015, 8:21pm UTC](https://www.ruby-forum.com/t/nginx-clojure-v0-4-1-release/242986/1 "2015-08-12T20:21:44Z")

</div>

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  
(stop-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  
NginxEmbedServer.getServer().start(“/my-dir/nginx.conf”);

//Start it with a given work dir  
NginxEmbedServer.getServer().setWorkDir(my-work-dir);  
NginxEmbedServer.getServer().start(…);

//Stop the server  
NginxEmbedServer.getServer().stop();  
default options:

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

```

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

Clojure:

> <https://github.com/nginx-clojure/nginx-clojure/blob/master/nginx-clojure-embed/test/clojure/nginx/clojure/test_embed.clj>

Java:

> <https://github.com/nginx-clojure/nginx-clojure/blob/master/nginx-clojure-embed/test/java/nginx/clojure/embed/JavaHandlersTest.java>

Web S. [http://nginx-clojure.github.io/](http://nginx-clojure.github.io/)  
Source Hosted on Github [GitHub - nginx-clojure/nginx-clojure: Nginx module for embedding Clojure or Java or Groovy programs, typically those Ring based handlers.](https://github.com/nginx-clojure/nginx-clojure)  
Google Group (mailing list)  
[Redirecting to Google Groups](https://groups.google.com/forum/#!forum/nginx-clojure)

Posted at Nginx Forum:

> **[\[ANN\] Nginx-Clojure v0.4.1 Release!](https://forum.nginx.org/read.php?2,260968,260968#msg-260968)**
>
> 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...
