Fixed a bug where if a consumer was slow to process streaming results, the result stream could be truncated.
kehaar.configured
can optionally use a var instead of a function for
incoming-services, incoming-events, and incoming-jobs, making repl-based
development simpler. Set the KEHAAR_DEBUG
environment variable to true
to
use this behavior.
Potentially breaking change: Kehaar no longer pulls in core.async as a
dependency. Since using core.async directly in your application code has
always been a requirement when using kehaar, we have switched it to
:scope "provided"
. You must add a recent version of
org.clojure/core.async
to your app's dependencies to use kehaar 1.0.0+.
The kehaar.rabbitmq
namespace has a new fn named
dissoc-blank-config-params-with-defaults
. This is an optional helper fn
whose purpose is to assist with not clobbering default values with emtpy
strings and nils in your RabbitMQ connection config map (i.e. the arg you'll
pass to connect-with-retries
). It dissoc's any value for the following
keys:
...where that value is either nil or a string for which
clojure.string/blank?
returns true.
Kehaar will output additional helpful information if an exception is thrown while trying to realize a symbol from a kehaar.configured handler fn name. Specifically it will tell you the name of the symbol it was trying to realize.
The EDN handling changes introduced in 0.11.0 have been ripped out. In practice they caused more problems than they solved. Only Clojure core developers can fix EDN in Clojure. Here's hoping they do so.
kehaar.rabbitmq/connect-with-retries
now retries to connect on any
Exception
subclass thrown rather than trying to catch specific ones.
Updated Langohr to 4.1.0
Initialization functions in kehaar.configured
can now also take
actual function and channel values where only symbols had been
expected before.
Rather than spinning up the maximum number of desired processing threads for each handler, kehaar now spins up threads as needed for the work coming in. It then allows them to be released if the workload decreases for a time. It still respects the thread count param and will never spin up more threads than that. This should prevent leaving idle threads hanging around forever just because they might be needed for workload spikes.
EDN reading and writing is now safer. Kehaar encodes all values going over
RabbitMQ into EDN using clojure.core/pr-str
and then calls
clojure.edn/read-string
on them when coming off of the queue on the other
side. In 0.11.0, kehaar will now convert instances of java.util.regex.Pattern
to their string representations before encoding them into EDN. This is
necessary because clojure.edn/read-string
will choke on the #"..."
form
they otherwise get encoded as. On the reading side, instead of
clojure.edn/read-string
's behavior of throwing exceptions on unknown tags,
kehaar will now simply read in the tagged values as is. This should prevent
exceptions coming from kehaar because of regexes or tagged representations
without registered data readers in your payloads.
Updated dependencies:
kehaar.rabbitmq/connect-with-retries
can now retry connection failures
that throw java.util.concurrent.TimeoutException
exceptions in addition to
the java.net.ConnectException
exceptions it has always been able to retry.
A Clojure 1.9-friendly ns
form in kehaar.response-queues.
When RabbitMQ renames response queues kehaar sets up for external services after a node restart, kehaar now reacts, ensuring that future calls to the external service use the new name for the reply-to queue.
Added prefetch limits to rabbit channels created when setting up streaming external services.
A couple of improvements to streaming:
threshold
values over the
shared reply queue, switching over to a bespoke queue after
threshold
+ 1 values.Due to changes in the messages that coordinate streaming behind the scenes, both the service producing streaming responses and its consumers must use Kehaar >= 0.10.0.
Added jobs. See README, kehaar.jobs, and kehaar.configured for details.
Added thread count option to init-incoming-event!
.
A new namespace with functions that allow for a more declarative description of your system.
Fixed the 3-arity version of external-service-fire-and-forget
to
call the 5-arity version of itself.
Added external-service-fire-and-forget
and
async->fire-and-forget-fn
, used much like their counterparts without
"fire-and-forget" in their names to send messages to an external
service but without waiting for a response.
Added an optional argument to incoming-service
called
ignore-no-reply-to
, which causes it to no longer log warnings when a
message comes without the :reply-to
metadata set. Good for
decreasing the noise in a service you expect to be used by the "fire
and forget" functions above.
start-responder!
, start-streaming-responder!
, and
start-event-handler!
can now take an extra argument: a number of
threads to use to pull messages from their input channels. The threads
will be created and be waiting on new messages immediately. The
default number of threads is 10.
When rabbit=>async
nacks a message, it sleeps for one second before
attempting to take another message. Eventually this will be
configurable.
Together with the limited number of threads for message handlers, this better allows for backpressure from core.async to RabbitMQ.
Added start-streaming-responder!
and streaming-external-service
to
the kehaar.wire-up
namespace for starting and consuming streaming
responses. Those functions are used for streaming responders in place
of start-responder!
and external-service
respectively.
A streaming responder function merely needs to return a sequence (lazy, if you like) and the values from that sequence will be sent across RabbitMQ to a core.async channel on the consumer's side.
Added kehaar.rabbitmq/connect-with-retries
function to make connecting to
RabbitMQ brokers more robust.
This is a major change. It renames and reworks the existing functionality.
The main motivation for this was to make kehaar more robust when faced with errors. EDN parse errors would cause the entire handler to crash. And kehaar would read as many messages as it could at a time, potentially overloading the server with no recourse for backpressure.
This rewrite solves those two problems while renaming and reworking the abstractions. The main difference is that the functions which pump messages to and from rabbit <=> core.async now pass the payload and metadata. This simplified the code a lot since we often need the metadata.
Event handlers and service responders now run in their own threads. call start-event-handler! and start-responder! in server initialization to start those. The return value of event handlers is ignored, but responders can return any value or a channel which will contain the value. This lets things remain asynchronous.
This is a breaking change. Many "lower-level" function in core
are very different. Other functions have been moved, renamed, and
their arguments are different.
An example project has been added at /example, to demonstrate how to
use the various functions in the wire-up
namespace.
In 0.2.0 ch->response-fn
started returning promises instead of core.async
channels. That is now reverted back to core.async channels.
This is a breaking change.
The kehaar.wire-up
namespace contains a higher-level interface for
declaring and setting up queues.
It came out.
kehaar.core
namespaceSince single-level namespaces are not recommended in Clojure, we have
moved the code that was in kehaar
to a new kehaar.core
ns.
This is a breaking change. You will need to update all your
(ns ... (:require [kehaar]))
forms in your code to look more like
this instead: (ns ... (:require [kehaar.core]))
.
rabbit->async
Previously kehaar auto-acked every incoming RabbitMQ message. Now it acks only when something successfully consumes the message from the core.async channel that it is forwarded to.
There are now debug-level log messages when Kehaar consumes a RabbitMQ message and when it forwards them on to core.async channels.
There are also warn-level log messages when it tries to take from a closed core.async channel.
This adds a dependency on clojure.tools.logging
0.3.1.
Use Clojure 1.7.0-RC2
nil?
checks when taking values from async channelsPulling from a core.async channel will return nil
if the channel is
closed, so now we check for that and stop trying to handle those
messages and stop trying to pull more.
Use Clojure 1.7.0-beta3 and Langohr 3.2.0.
kehaar/async->rabbit
no longer declares the queue it operates
on. This is a breaking change. Queues must now be already
declared. This allows, for example, the queue to be
a server-named, exclusive, auto-deleted queue.
The old kehaar/rabbit->async
function has been renamed
kehaar/rabbit->async-handler-fn
, and kehaar/rabbit->async
now
takes the RabbitMQ queue and the async channel, handling the
subscription for you. This is a breaking change.
rabbit->async
and async->rabbit
now appropriately mirror the
other.
kehaar/rabbit->async-handler-fn
now blocks if the async channel's
buffer is full, providing the opportunity for some back pressure.
kehaar/ch->response-fn
now returns promises instead of async
channels for the caller to wait on. This is a breaking change.
kehaar/wire-up-service
no longer declares the queue it operates on
either. This is a breaking change. Queues must now already be
declared. Additionally, internally, it uses a server-named, exclusive,
auto-deleted queue.
kehaar/simple-responder
has been renamed kehaar/fn->handler-fn
and
a new function kehaar/responder
has been made which takes a RabbitMQ
channel and queue and a function to apply to all messages, replying on
the reply-to queue with the result. This is a breaking change.
There are now tests which use RabbitMQ, however they are not run by
default with lein run
. In order to run the RabbitMQ tests, start
rabbitmq-server
with its default configuration and run lein test :rabbit-mq
. To run all tests, run lein test :all
.
Travis CI has been updated to run those tests as well.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close