<commit_before>;; Copyright 2014-2015 Red Hat, Inc, and individual contributors.
;;
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

(ns immutant.messaging
  "Easily publish and receive messages containing any type of nested
   data structure to dynamically-created queues and topics."
  (:require [immutant.internal.options :as o]
            [immutant.internal.util    :as u]
            [immutant.codecs           :as codecs]
            [immutant.messaging.internal :refer :all])
  (:import [org.projectodd.wunderboss.messaging Context Destination
            Destination$ListenOption
            Destination$PublishOption
            Destination$ReceiveOption
            Message
            Messaging Messaging$CreateContextOption
            Messaging$CreateOption Messaging$CreateQueueOption
            Messaging$CreateTopicOption
            Queue Topic
            Topic$SubscribeOption Topic$UnsubscribeOption]))

(defn ^Context context
  "Creates a messaging context.

   A context represents a remote or local connection to the messaging
   broker.

   There are three reasons you would create a context rather
   than rely on the messaging functions to lazily create them as
   needed:

   1) for communicating with a remote HornetQ instance
   2) for sharing a context among a batch of messaging operations
   3) for decoupling the client-id from the subscription name for
      durable topic subscriptions (see [[subscribe]])

   You are responsible for closing any contexts created via this
   function.

   Options that apply to both local and remote contexts are [default]:

   * :client-id - identifies the context for use with a durable topic
                  subscriber (see [[subscribe]]) [nil]
   * :xa?       - if true, returns an XA context for use in a
                  distributed transaction [false]
   * :mode      - one of: :auto-ack, :client-ack, :transacted. Ignored
                  if :xa? is true. [:auto-ack]

   Options that apply to only remote contexts are [default]:

   * :host - the host of a remote broker [nil]
   * :port - the port of a remote broker [nil, 5445 if :host provided]
   * :username - a username for the remote broker [nil]
   * :password - the corresponding password for :username [nil]
   * :remote-type - when connecting to a HornetQ instance running
                    inside WildFly, this needs to be set to
                    :hornetq-wildfly [:hornetq-standalone]<commit_msg>Fix context ordered-list.<commit_after>;; Copyright 2014-2015 Red Hat, Inc, and individual contributors.
;;
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

(ns immutant.messaging
  "Easily publish and receive messages containing any type of nested
   data structure to dynamically-created queues and topics."
  (:require [immutant.internal.options :as o]
            [immutant.internal.util    :as u]
            [immutant.codecs           :as codecs]
            [immutant.messaging.internal :refer :all])
  (:import [org.projectodd.wunderboss.messaging Context Destination
            Destination$ListenOption
            Destination$PublishOption
            Destination$ReceiveOption
            Message
            Messaging Messaging$CreateContextOption
            Messaging$CreateOption Messaging$CreateQueueOption
            Messaging$CreateTopicOption
            Queue Topic
            Topic$SubscribeOption Topic$UnsubscribeOption]))

(defn ^Context context
  "Creates a messaging context.

   A context represents a remote or local connection to the messaging
   broker.

   There are three reasons you would create a context rather
   than rely on the messaging functions to lazily create them as
   needed:

   1. for communicating with a remote HornetQ instance
   2. for sharing a context among a batch of messaging operations
   3. for decoupling the client-id from the subscription name for
      durable topic subscriptions (see [[subscribe]])

   You are responsible for closing any contexts created via this
   function.

   Options that apply to both local and remote contexts are [default]:

   * :client-id - identifies the context for use with a durable topic
                  subscriber (see [[subscribe]]) [nil]
   * :xa?       - if true, returns an XA context for use in a
                  distributed transaction [false]
   * :mode      - one of: :auto-ack, :client-ack, :transacted. Ignored
                  if :xa? is true. [:auto-ack]

   Options that apply to only remote contexts are [default]:

   * :host - the host of a remote broker [nil]
   * :port - the port of a remote broker [nil, 5445 if :host provided]
   * :username - a username for the remote broker [nil]
   * :password - the corresponding password for :username [nil]
   * :remote-type - when connecting to a HornetQ instance running
                    inside WildFly, this needs to be set to
                    :hornetq-wildfly [:hornetq-standalone]
{'fraction_non_alphanumeric': 0.06765899864682003, 'fraction_numerical': 0.0064276048714479025, 'mean_word_length': 2.874836173001311, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6943035', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1455, 'n_words': 671}