Skip to content

Commit

Permalink
Be able to supply a socket factory and topology recovery retry handle…
Browse files Browse the repository at this point in the history
…r if desired
  • Loading branch information
Vincent Pizzo committed Oct 4, 2022
1 parent 40b4dcd commit 30a445f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/clojure/langohr/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@
* http://clojurerabbitmq.info/articles/connecting.html
* http://clojurerabbitmq.info/articles/tls.html"
(:import [com.rabbitmq.client Connection Channel Address
ConnectionFactory ShutdownListener BlockedListener
Consumer TopologyRecoveryException
ExceptionHandler Recoverable RecoveryListener DefaultSaslConfig]
ConnectionFactory ShutdownListener BlockedListener
Consumer TopologyRecoveryException
ExceptionHandler Recoverable RecoveryListener DefaultSaslConfig]
[com.rabbitmq.client.impl ForgivingExceptionHandler AMQConnection]
[com.rabbitmq.client.impl.recovery AutorecoveringConnection QueueRecoveryListener]
[com.rabbitmq.client.impl.recovery AutorecoveringConnection QueueRecoveryListener RetryHandler]
clojure.lang.IFn
java.util.concurrent.ThreadFactory)
java.util.concurrent.ThreadFactory
(javax.net SocketFactory))
(:require langohr.channel
[clojure.string :as s]
[clojure.walk :as walk]))
Expand Down Expand Up @@ -325,7 +326,7 @@
(let [{:keys [host port username password vhost
requested-heartbeat connection-timeout ssl ssl-context verify-hostname socket-factory sasl-config
requested-channel-max thread-factory exception-handler
connection-name update-client-properties]
connection-name update-client-properties topology-recovery-retry-handler]
:or {requested-heartbeat ConnectionFactory/DEFAULT_HEARTBEAT
connection-timeout ConnectionFactory/DEFAULT_CONNECTION_TIMEOUT
requested-channel-max ConnectionFactory/DEFAULT_CHANNEL_MAX
Expand Down Expand Up @@ -360,6 +361,10 @@
(.enableHostnameVerification cf))
(when thread-factory
(.setThreadFactory cf ^ThreadFactory thread-factory))
(when topology-recovery-retry-handler
(.setTopologyRecoveryRetryHandler cf ^RetryHandler topology-recovery-retry-handler))
(when socket-factory
(.setSocketFactory cf ^SocketFactory socket-factory))
(if exception-handler
(.setExceptionHandler cf ^ExceptionHandler exception-handler)
(.setExceptionHandler cf (ForgivingExceptionHandler.)))
Expand Down

0 comments on commit 30a445f

Please sign in to comment.