Easily publish and receive messages containing any type of nested
data structure to dynamically-created topics and queues. Message
distribution is automatically load-balanced when clustered.
as-queue
function
Usage: (as-queue name)
Marks the given queue name as a queue. Useful for working with queues that
don't follow the Immutant convention of containing "queue" in the name.
The result can be passed to any immutant.messaging functions that take a
queue name.
as-topic
function
Usage: (as-topic name)
Marks the given topic name as a topic. Useful for working with topics that
don't follow the Immutant convention of containing "topic" in the name.
The result can be passed to any immutant.messaging functions that take a
topic name.
listen
function
Usage: (listen dest f & {:keys [concurrency decode?], :or {concurrency 1, decode? true}, :as opts})
The handler function, f, will receive each message sent to dest.
dest can either be the name of the destination, a
javax.jms.Destination, or the result of as-queue or as-topic.
The following options are supported [default]:
:concurrency the number of threads handling messages [1]
:selector A JMS (SQL 92) expression matching message metadata/properties
:decode? if true, the decoded message body is passed to f. Otherwise, the
javax.jms.Message object is passed [true]
:name A name for this listener that is used to give the mbean a known
identifier, and to allow future calls to listen with the same
:name to replace the prior listener with that name [nil]
:client-id identifies a durable topic subscriber, ignored for queues [nil]
:host the remote host to connect to (default is to connect in-vm) [nil]
:port the remote port to connect to (requires :host to be set) [nil,
or 5445 if :host is set]
:username the username to use to auth the connection (requires :password
to be set) [nil]
:password the password to use to auth the connection (requires :username
to be set) [nil]
message-seq
function
Usage: (message-seq dest & opts)
A lazy sequence of messages received from a destination. Accepts
same options as receive.
publish
function
Usage: (publish dest message & {:as opts})
Send a message to a destination. dest can either be the name of the
destination, a javax.jms.Destination, or the result of as-queue or
as-topic. If the message is a javax.jms.Message, then the message
is sent without modification. If the message contains metadata, it
will be transferred as JMS properties and reconstituted upon
receipt. Metadata keys must be valid Java identifiers (because they
can be used in selectors) and can be overridden using
the :properties option. Returns the JMS message object that was
published.
The following options are supported [default]:
:encoding :clojure :json or :text [:clojure]
:priority 0-9 or :low :normal :high :critical [4]
:ttl time to live, in ms [0=forever]
:persistent whether undelivered messages survive restarts [true]
:properties a hash to which selectors may be applied, overrides metadata [nil]
:correlation-id used to set the JMSCorrelationID [nil]
see http://docs.oracle.com/javaee/6/api/javax/jms/Message.html#setJMSCorrelationID(java.lang.String)
:host the remote host to connect to (default is to connect in-vm)
[nil]
:port the remote port to connect to (requires :host to be set)
[nil, or 5445 if :host is set]
:username the username to use to auth the connection (requires :password
to be set) [nil]
:password the password to use to auth the connection (requires :username
to be set) [nil]
receive
function
Usage: (receive dest & {:keys [timeout decode?], :or {timeout 10000, decode? true}, :as opts})
Receive a message from a destination. dest can either be the name
of the destination, a javax.jms.Destination, or the result of
as-queue or as-topic.
The following options are supported [default]:
:timeout time in ms, after which nil is returned [10000]
:selector A JMS (SQL 92) expression matching message metadata/properties
:decode? if true, the decoded message body is returned. Otherwise, the
javax.jms.Message object is returned [true]
:client-id identifies a durable topic subscriber, ignored for queues [nil]
:host the remote host to connect to (default is to connect in-vm) [nil]
:port the remote port to connect to (requires :host to be set) [nil, or
5445 if :host is set]
:username the username to use to auth the connection (requires :password to
be set) [nil]
:password the password to use to auth the connection (requires :username to
be set) [nil]
request
function
Usage: (request queue message & {:as opts})
Send a message to queue and return a delay that will retrieve the response.
Implements the request-response pattern, and is used in conjunction
with respond. The queue parameter can either be the name of a
queue, an actual javax.jms.Queue, or the result of as-queue.
It takes the same options as publish, and one more [default]:
:timeout time in ms for the delayed receive to wait once it it is
dereferenced, after which nil is returned [10000]
respond
function
Usage: (respond queue f & {:keys [decode?], :or {decode? true}, :as opts})
Listen for messages on queue sent by the request function and
respond with the result of applying f to the message. queue can
either be the name of the queue, a javax.jms.Queue, or the result
of as-queue. Accepts the same options as listen.
start
function
Usage: (start name & opts)
Create a message destination; name should begin with either 'queue'
or 'topic', or be the result of calling as-queue or as-topic.
The following options are supported [default]:
:durable whether queue items persist across restarts [false]
:selector A JMS (SQL 92) expression matching message metadata/properties [""]
stop
function
Usage: (stop name & {:keys [force]})
Destroy a message destination. Typically not necessary since it
will be done for you when your app is undeployed. This will fail
with a warning if any handlers are listening or any messages are
yet to be delivered. Returns true on success
unlisten
function
Usage: (unlisten listener)
Pass the result of a call to listen or respond to de-register the handler.
You only need to do this if you wish to stop the handler's
destination before your app is undeployed.
unsubscribe
function
Usage: (unsubscribe client-id & {:keys [subscriber-name], :or {subscriber-name default-subscriber-name}, :as opts})
Used when durable topic subscribers are no longer interested. This
cleans up some server-side state, but since it'll be be deleted
anyway when the topic is stopped, it's an optional call
AsText
var
Function for extracting text from a message.
Source
decode-if
function
Usage: (decode-if decode? msg)
Decodes the given message if decode? is truthy. If the decoded
message is a clojure collection, the properties of the message will
be affixed as metadata
Source
get-encoding
function
Usage: (get-encoding msg)
Retrieve the encoding from a JMS message.
Source
->QueueMarker
function
Usage: (->QueueMarker name)
Positional factory function for class immutant.messaging.core.QueueMarker.
Source
->TopicMarker
function
Usage: (->TopicMarker name)
Positional factory function for class immutant.messaging.core.TopicMarker.
Source
create-connection
function
Usage: (create-connection opts)
Creates a connection and registers it in the *connections* map
Source
create-consumer
function
Usage: (create-consumer session destination {:keys [selector client-id subscriber-name], :or {subscriber-name default-subscriber-name}})
Creates a consumer for a session and destination that may be a durable topic subscriber
Source
enlist-session
function
Usage: (enlist-session session)
Enlist a session in the current transaction, if any
Source
get-properties
function
Usage: (get-properties message & {:keys [keywords], :or {keywords true}})
Extract properties from message into a map, turning the JMS
property names into keywords unless the :keywords option is false
Source
map->QueueMarker
function
Usage: (map->QueueMarker m__5665__auto__)
Factory function for class immutant.messaging.core.QueueMarker, taking a map of keywords to field values.
Source
map->TopicMarker
function
Usage: (map->TopicMarker m__5665__auto__)
Factory function for class immutant.messaging.core.TopicMarker, taking a map of keywords to field values.
Source
set-attributes!
function
Usage: (set-attributes! message attributes)
Sets attributes on a JMS message. Returns message.
Source
set-properties!
function
Usage: (set-properties! message properties)
Set user-defined properties on a JMS message. Returns message
Source
wash-publish-options
function
Usage: (wash-publish-options opts producer)
Wash publish options relative to default values from a producer
Source
connection-factory
function
Usage: (connection-factory)
(connection-factory {:keys [host port], :or {host localhost, port 5445}})
Create a connection factory, typically invoked when outside container
Source