The ClojureWerkz Blog

News and updates about ClojureWerkz projects

Validateur 2.0.0 Is Released

TL;DR

Validateur is a functional validations library inspired by Ruby’s ActiveModel. Validateur 2.0 is a feature release.

Changes Between 1.7.0 and 2.0.0

Clojure 1.6

Validateur now depends on org.clojure/clojure version 1.6.0. It is still compatible with Clojure 1.4 and if your project.clj depends on a different version, it will be used, but 1.6 is the default now.

Validator Predicates (Guards)

It is now possible to wrap a validator into a function that will check a condition before applying the validator.

To do so, use validate-when:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(require '[validateur.validation])

(defn new?
  [user]
  (nil? (:id user)))

(defn unique-email?
  [user]
  (if-let [existing (find-by-email (:email user)]
    (= (:id user) (:id existing))
    true))

(def validate
  (validation-set
    (presence-of :email)
    (validate :email unique-email? :message "is already taken")
    (validate-when new? (presence-of :password))
    (validate-when #(contains? % :password) (presence-of :password))))

If provided predicate returns false, the validator it guards is not executed.

Contributed by Scott Nelson.

Generic Validator

Generic validator uses a predicate function and attaches errors to specified attribute:

1
2
3
(require '[validateur.validation])

(validate-with-predicate :id unique? :message "ID is not unique")

Contributed by Scott Nelson.

ClojureWerkz Support Dependency Dropped

ClojureWerkz Support is no longer a dependency of Validateur. This makes it easier to use Validateur in ClojureScript projects.

Contributed by hura.

Validation Set Composition

Validateur now supports composition of validation sets. To compose several sets, use validateur.validation/compose-sets:

1
2
3
4
5
6
7
(let [vn (vr/validation-set
           (vr/presence-of :name))
      va (vr/validation-set
           (vr/presence-of :age))
      v  (vr/compose-sets va vn)]
  ;= true
  (vr/valid? v { :name "Joe" :age 28 }))

Contributed by hura.

Full Change Log

Validateur change log is available on GitHub.

Validateur is a ClojureWerkz Project

Validateur is part of the group of libraries known as ClojureWerkz, together with

  • Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
  • Monger, a Clojure MongoDB client for a more civilized age
  • Elastisch, a minimalistic Clojure client for ElasticSearch
  • Cassaforte, a Clojure Cassandra client built around CQL
  • Neocons, a client for the Neo4J REST API
  • Welle, a Riak client with batteries included
  • Quartzite, a powerful scheduling library

and several others. If you like Validateur, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About The Author

Michael on behalf of the ClojureWerkz Team

Elastisch 2.0.0-beta2 Is Released

TL;DR

Elastisch is a battle tested, small but feature rich and well documented Clojure client for ElasticSearch. It supports virtually every Elastic Search feature and has solid documentation.

2.0.0-beta2 is a preview release of Elastisch 2.0, which focuses on the new features in ElasticSearch 1.0.

Changes between Elastisch 2.0.0-beta1 and 2.0.0-beta2

(Improved) Aggregation Support

Elastisch 2.0 features multiple convenience functions for working with ElasticSearch aggregations.

clojurewerkz.elastisch.aggregation is a new namespace that contains helper functions that produce various types of aggregations. Just like clojurewerkz.elastisch.query, all of the functions return maps and are optional.

clojurewerkz.elastisch.rest.response/aggregations-from is a new function that returns aggregations from a search response:

1
2
3
4
5
6
7
8
9
10
11
12
(require '[clojurewerkz.elastisch.rest.document :as doc])
(require '[clojurewerkz.elastisch.query :as q])
(require '[clojurewerkz.elastisch.aggregation :as a])
(require '[clojurewerkz.elastisch.rest.response :refer [aggregations-from]])

(let [index-name   "people"
        mapping-type "person"
        response     (doc/search index-name mapping-type
                                 :query (q/match-all)
                                 :aggregations {:min_age (a/min "age")})
        agg          (aggregation-from response :min_age)]
    (is (= {:value 22.0} agg)))

Aggregations support is primarily focused on REST client at the moment.

clj-http Update

clj-http dependency has been upgraded to version 0.9.1.

Full Change Log

Elastisch change log is available on GitHub.

Thank You, Contributors

Kudos to Richie Vos for contributing to this release.

Elastisch is a ClojureWerkz Project

Elastisch is part of the group of libraries known as ClojureWerkz, together with

  • Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
  • Monger, a Clojure MongoDB client for a more civilized age
  • Cassaforte, a Clojure Cassandra client
  • Titanium, a Clojure graph library
  • Neocons, a client for the Neo4J REST API
  • Welle, a Riak client with batteries included
  • Quartzite, a powerful scheduling library

and several others. If you like Elastisch, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About the Author

Michael on behalf of the ClojureWerkz Team

Meltdown 1.0.0-beta8 Is Released

TL;DR

Meltdown is a Clojure interface to Reactor, an asynchronous programming, event passing and stream processing toolkit for the JVM.

1.0.0-beta8 is a development milestone with minor improvements.

Changes between 1.0.0-beta7 and 1.0.0-beta8

Key in Event Payload

Meltdown now includes event key when transforming them into Clojure maps.

Example event map:

1
{:data {:event delivered}, :reply-to nil, :headers {}, :key events.dummy, :id #uuid "5714bb01-ac7e-11e3-64b3-6b2c231ad83a"}

Changes between 1.0.0-beta6 and 1.0.0-beta7

Match-All Selector

clojurewerkz.meltdown.selectors/predicate is a new function that creates a match-all selector (a predicate selector that unconditionally returns true).

Predicate Selectors

clojurewerkz.meltdown.selectors/predicate is a new function that creates a predicate selector:

1
2
3
4
5
6
7
8
(require '[clojurewerkz.meltdown.reactor   :as mr])
(require '[clojurewerkz.meltdown.selectors :as ms])

(let [r   (mr/create)
      ;; will filter out events with keys that are
      ;; odd numbers
      sel (ms/predicate even?)]
)

Changes between 1.0.0-beta5 and 1.0.0-beta6

Reactor Update

Reactor is updated to 1.1.0.M2.

Change log

Meltodwn change log is available on GitHub.

Meltdown is a ClojureWerkz Project

Meltdown is part of the group of libraries known as ClojureWerkz, together with

  • Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
  • Elastisch, a Clojure client for ElasticSearch
  • Monger, a Clojure MongoDB client for a more civilized age
  • Cassaforte, a Clojure Cassandra client
  • Titanium, a Clojure graph library
  • Neocons, a client for the Neo4J REST API
  • Quartzite, a powerful scheduling library

and several others. If you like Meltdown, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About the Author

Michael on behalf of the ClojureWerkz Team

Langohr 2.7.1 Is Released

TL;DR

Langohr is a small Clojure RabbitMQ client.

2.7.1 is a minor feature release.

Changes between Langohr 2.6.x and 2.7.1

langohr.http/list-enabled-protocols

langohr.http/list-enabled-protocols is a new function that lists the protocols a RabbitMQ installation supports, e.g. "amqp" or "mqtt". Note that this currently does not include WebSTOMP (due to certain technical decisions in RabbitMQ Web STOMP plugin).

Changes between Langohr 2.5.x and 2.6.0

langohr.http/list-connections-from, /close-connections-from

langohr.http/list-connections-from and langohr.http/close-connections-from are two new functions that list and close connections for a given username, respectively:

1
2
3
4
5
6
7
(require '[langohr.http :as hc])

(hc/list-connections-from "guest")
;= a list of connections with username "guest"

;; closes all connections from "guest"
(hc/close-connections-from "guest")

clj-http Upgrade

clj-http dependency has been updated to 0.9.0.

Change Log

Langohr change log is available on GitHub.

Langohr is a ClojureWerkz Project

Langohr is part of the group of libraries known as ClojureWerkz, together with

  • Elastisch, a minimalistic well documented Clojure client for ElasticSearch
  • Cassaforte, a Clojure Cassandra client built around CQL 3.0
  • Monger, a Clojure MongoDB client for a more civilized age
  • Neocons, a client for the Neo4J REST API
  • Quartzite, a powerful scheduling library

and several others. If you like Langohr, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About The Author

Michael on behalf of the ClojureWerkz Team

Elastisch 2.0.0-beta1 Is Released

TL;DR

Elastisch is a battle tested, small but feature rich and well documented Clojure client for ElasticSearch. It supports virtually every Elastic Search feature and has solid documentation.

2.0.0-beta1 is a preview release of Elastisch 2.0, which focuses on ElasticSearch 1.0 compatibility.

Changes between Elastisch 1.4.0 and 2.0.0

ElasticSearch 1.0 Compatibility

Main goal of Elastisch 2.0 is ElasticSearch 2.0 compatibility. This includes minor API changes (in line with ElasticSearch 1.0 API and terminology changes) and moderate internal modifications.

Support for cluster nodes stats and info REST APIs

clojureworkz.elastisch.rest.admin/nodes-info and clojureworkz.elastisch.rest.admin/nodes-stats are new administrative functions that provide access to ElasticSearch cluster stats and node info.

Examples:

1
2
3
4
5
6
7
8
9
(require '[clojurewerkz.elastisch.rest.admin :as admin])

(admin/nodes-stats)
(admin/nodes-stats :nodes "_all")
(admin/nodes-stats :nodes ["node1" "node2"] ["indices" "os" "plugins"])

(admin/nodes-info)
(admin/nodes-info :nodes "_all")
(admin/nodes-info :nodes ["node1" "node2"] ["indices" "os" "plugins"])

See ElasticSearch nodes stats documentation, nodes info page, and node specification page for more info.

Contributed by Joachim De Beule.

Support for _cluster/state REST API

Added (clojureworkz.elastisch.rest.admin/cluster-state & {:as params})

Examples:

1
2
3
4
(require '[clojurewerkz.elastisch.rest.admin :as admin])

(admin/cluster-state)
(admin/cluster-state :filter_nodes true)

See ElasticSearch documentation for more info.

Contributed by Joachim De Beule.

Support for _cluster/health REST API

Added (clojureworkz.elastisch.rest.admin/cluster-health & {:as params})

Example:

1
2
3
4
5
6
(require '[clojurewerkz.elastisch.rest.admin :as admin])

(admin/cluster-health)
(admin/cluster-health :index "index1")
(admin/cluster-health :index ["index1","index2"])
(admin/cluster-health :index "index1" :pretty true :level "indices")

See ElasticSearch documentation for more info.

Contributed by Joachim De Beule.

Support for analyze in REST API client

Added (doc/analyze text & {:as params})

See ElasticSearch documentation for more info.

Examples:

1
2
3
4
5
6
7
(require '[clojurewerkz.elastisch.rest.document :as doc])

(doc/analyze "foo bar baz")
(doc/analyze "foo bar baz" :index "some-index-name")
(doc/analyze "foo bar baz" :analyzer "whitespace")
(doc/analyze "foo bar baz" :tokenizer "keyword" :filters "lowercase")
(doc/analyze "foo bar baz" :index "some-index-name" :field "some-field-name")

Contributed by Joachim De Beule

Query String Escaping

clojurewerkz.elastisch.query/query-string accepts a new option, :escape-with, which is a function that performs escaping of special characters in query string queries.

By default clojurewerkz.elastisch.escape/escape-query-string-characters is used.

Contributed by Ben Reinhart (Groupon).

ElasticSearch Native Client Upgrade

Elastisch now depends on ElasticSearch native client version 1.0.1.

clj-http Update

clj-http dependency has been upgraded to version 0.9.0.

Full Change Log

Elastisch change log is available on GitHub.

Thank You, Contributors

Kudos to Richie Vos for contributing to this release.

Elastisch is a ClojureWerkz Project

Elastisch is part of the group of libraries known as ClojureWerkz, together with

  • Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
  • Monger, a Clojure MongoDB client for a more civilized age
  • Cassaforte, a Clojure Cassandra client
  • Titanium, a Clojure graph library
  • Neocons, a client for the Neo4J REST API
  • Welle, a Riak client with batteries included
  • Quartzite, a powerful scheduling library

and several others. If you like Elastisch, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About the Author

Michael on behalf of the ClojureWerkz Team

Langohr 2.5.0 Is Released

TL;DR

Langohr is a small Clojure RabbitMQ client.

2.5.0 is a minor feature release that also deprecates several functions.

Changes between Langohr 2.3.x and 2.5.0

langohr.http/declare-user Renamed

langohr.http/declare-user was renamed to langohr.http/set-user.

langohr.http/declare-policy Renamed

langohr.http/declare-policy was renamed to langohr.http/set-policy.

langohr.http/declare-permissions Renamed

langohr.http/declare-permissions was renamed to langohr.http/set-permissions.

langohr.http/declare-user Renamed

langohr.http/declare-user was renamed to langohr.http/add-user.

langohr.http/vhost-exists?

langohr.http/vhost-exists? is a new function that returns true if provided vhost exists:

1
2
3
(require '[langohr.http :as hc])

(hc/vhost-exists? "killer-app-dev")

langohr.http/user-exists?

langohr.http/user-exists? is a new function that returns true if provided user exists:

1
2
3
(require '[langohr.http :as hc])

(hc/user-exists? "monitoring")

RabbitMQ Java Client Upgrade

RabbitMQ Java client dependency has been updated to 3.2.4.

clj-http Upgrade

clj-http dependency has been updated to 0.7.9.

Topology Recovery Default

:automatically-recover-topology default is now true, as listed in documentation.

Contributed by Ilya Ivanov.

Deprecations

langohr.core/automatically-recover? is deprecated

Use langohr.core/automatic-recovery-enabled? instead.

Change Log

Langohr change log is available on GitHub.

Langohr is a ClojureWerkz Project

Langohr is part of the group of libraries known as ClojureWerkz, together with

  • Elastisch, a minimalistic well documented Clojure client for ElasticSearch
  • Cassaforte, a Clojure Cassandra client built around CQL 3.0
  • Monger, a Clojure MongoDB client for a more civilized age
  • Neocons, a client for the Neo4J REST API
  • Quartzite, a powerful scheduling library

and several others. If you like Langohr, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About The Author

Michael on behalf of the ClojureWerkz Team

Meltdown 1.0.0-beta5 Is Released

TL;DR

Meltdown is a Clojure interface to Reactor, an asynchronous programming, event passing and stream processing toolkit for the JVM.

1.0.0-beta5 is a development milestone release that updates Reactor to 1.1.0.M1 and includes a few bug fixes and minor API refinements.

Changes between 1.0.0-beta4 and 1.0.0-beta5

Environment Reuse

Previously Meltdown instantiated a new Environment per clojurewerkz.meltdown.reactor/create invocation without a provided environment. This lead to excessive thread creation which could eventually exhaust system resources.

Meltdown 1.0.0-beta5 will reuse the same environment for all created reactors unless its asked to use a specific Environment instance.

Environment Functions

clojurewerkz.meltdown.env/environment is a function that returns a shared environment. To create a completely new environment from scratch, use clojurewerkz.meltdown.env/create.

clojurewerkz.meltdown.env/shutdown shuts down environments and all associated dispatchers.

clojurewerkz.meltdown.fn/->filter

clojurewerkz.meltdown.fn/->filter is a new function that reifies Reactor filters from Clojure functions.

Changes between 1.0.0-beta3 and 1.0.0-beta4

Moved Functions

clojurewerkz.meltdown.streams/fn->function and clojurewerkz.meltdown.streams/fn->predicate are removed, use clojurewerkz.meltdown.fn/->function and clojurewerkz.meltdown.fn/->predicate instead.

Streams Flushing

Stream operations are now lazier in Reactor. To enforce stream sources to be drained, use clojurewerkz.meltdown.streams/flush which accepts a stream or deferred.

Reactor Update

Reactor is updated to 1.1.0.M1 which has multiple breaking API changes.

Change log

Meltodwn change log is available on GitHub.

Meltdown is a ClojureWerkz Project

Meltdown is part of the group of libraries known as ClojureWerkz, together with

  • Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
  • Elastisch, a Clojure client for ElasticSearch
  • Monger, a Clojure MongoDB client for a more civilized age
  • Cassaforte, a Clojure Cassandra client
  • Titanium, a Clojure graph library
  • Neocons, a client for the Neo4J REST API
  • Quartzite, a powerful scheduling library

and several others. If you like Meltdown, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About the Author

Michael on behalf of the ClojureWerkz Team

Route One 1.1.0 Is Released

Route One is a Clojure DSL for URL/URI/path generation from a route map, compatible with Compojure’s Clout.

Changes Between 1.0.0 and 1.1.0

Extra Keys as Query Parameters

Generate and append query from data keys that don’t appear as path segments.

Contributed by Ray Miller.

Back-reference Escaping

When replacing path segments, use re-quote-replacement to escape any back-references in the replacement string.

Contributed by Ray Miller.

Change log

Route One change log is available on GitHub.

Route One is a ClojureWerkz Project

Route One is part of the group of libraries known as ClojureWerkz, together with

  • Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
  • Elastisch, a small feature complete Clojure client for ElasticSearch
  • Cassaforte, a Clojure Cassandra client
  • Neocons, a client for the Neo4J REST API
  • Monger, a Clojure MongoDB client for a more civilized age
  • Titanium, a Clojure graph library
  • Welle, a Riak client with batteries included
  • Quartzite, a powerful scheduling library

and several others. If you like Elastisch, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About The Author

Michael on behalf of the ClojureWerkz Team

Pantomime 2.1.0 Is Released

TL;DR

Pantomime is a tiny Clojure library for working with MIME types and file metadata.

Changes between Pantomime 2.0.0 and 2.1.0

Apache Tika 1.5

Apache Tika dependency has been upgraded to version 1.5.

Change Log

We recommend all users to upgrade to 2.1.0.

Pantomime change log is available on GitHub.

Pantomime is a ClojureWerkz Project

Pantomime is part of the group of libraries known as ClojureWerkz, together with

  • Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
  • Elastisch, a minimalistic Clojure client for ElasticSearch
  • Cassaforte, a Clojure Cassandra client built around CQL
  • Monger, a Clojure MongoDB client for a more civilized age
  • Welle, a Riak client with batteries included
  • Neocons, a client for the Neo4J REST API
  • Quartzite, a powerful scheduling library

and several others. If you like Pantomime, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

Michael on behalf of the ClojureWerkz Team

Mailer 1.0.0 Is Released

TL;DR

ClojureWerkz Mailer is an ActionMailer-inspired mailer library for Clojure. It combines Postal, Clostache and a number of its own features and conventions to make delivering complex template-based emails as painless as possible.

Why Use Mailer

All the building blocks to make email rendering and delivery easy in Clojure have been in place for a while, Mailer simply combines them and brings in some time tested ideas from Action Mailer.

What’s In The Box

Mailer lets you:

  • Send email using pluggable transports
  • Use Moustache templates for email
  • Generate HTML and/or plain text email
  • Deliver mail over SMTP or Sendmail
  • Test rendered emails easily

Documentation

Mailer is a small library and all of its documentation guide fits in the README.

Project Maturity

Mailer is a moderately mature project, the API hasn’t changed in over a year.

Supported Clojure Versions

Mailer supports Clojure 1.4+.

News and Updates

New releases and updates are announced on Twitter.

Mailer is a ClojureWerkz Project

Mailer is part of the group of libraries known as ClojureWerkz, together with

  • Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
  • Elastisch, a minimalistic Clojure client for ElasticSearch
  • Cassaforte, a Clojure client for Cassandra built around CQL
  • Monger, a Clojure MongoDB client for a more civilized age
  • Welle, a Riak client with batteries included
  • Neocons, a Clojure client for the Neo4J REST API

and several others. If you like Mailer, you may also like our other projects.

Let us know what you think on Twitter or on the Clojure mailing list.

About the Author

Michael on behalf of the ClojureWerkz Team.