Skip to content

Commit

Permalink
Merge pull request #119 from jimpil/master
Browse files Browse the repository at this point in the history
introduce http2
  • Loading branch information
michaelklishin authored Aug 7, 2023
2 parents 32c72a7 + 91a8307 commit e4c9096
Show file tree
Hide file tree
Showing 6 changed files with 707 additions and 42 deletions.
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.8"
services:
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: 'rabbitmq'
ports:
- 5672:5672
- 15672:15672
volumes:
- ~/.docker-conf/rabbitmq/data/:/var/lib/rabbitmq/
- ~/.docker-conf/rabbitmq/log/:/var/log/rabbitmq
networks:
- rabbitmq_go_net

networks:
rabbitmq_go_net:
driver: bridge
7 changes: 4 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
[com.rabbitmq/amqp-client "5.18.0"]
[clojurewerkz/support "1.1.0" :exclusions [com.google.guava/guava]]
[clj-http "3.12.3"]
[cheshire "5.10.1"]]
[hato "0.9.0"]
[cheshire "5.11.0"]]
:profiles {:1.10 {:dependencies [[org.clojure/clojure "1.10.2"]]}
:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}
:master {:dependencies [[org.clojure/clojure "1.12.0-master-SNAPSHOT"]]}
Expand All @@ -18,7 +19,7 @@
:source-uri "https://github.com/michaelklishin/langohr/blob/v{version}/{filepath}#L{line}"}}}
:source-paths ["src/clojure"]
:java-source-paths ["src/java"]
:javac-options ["-target" "1.8" "-source" "1.8"]
:javac-options ["-target" "11" "-source" "11"]
:url "https://clojurerabbitmq.info"
:repositories {"sonatype" {:url "https://oss.sonatype.org/content/repositories/releases"
:snapshots false
Expand All @@ -42,7 +43,7 @@
:time-consuming :time-consuming
:performance :performance
:tls :tls
:ci (fn [m] (not (:tls m)))}
:ci (complement :tls)}
:mailing-list {:name "clojure-rabbitmq"
:archive "https://groups.google.com/group/clojure-rabbitmq"
:post "clojure-rabbitmq@googlegroups.com"})
58 changes: 26 additions & 32 deletions src/clojure/langohr/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -239,44 +239,40 @@
(defn exception-handler
[{:keys [handle-connection-exception-fn
handle-return-listener-exception-fn
handle-flow-listener-exception-fn
;handle-flow-listener-exception-fn
handle-confirm-listener-exception-fn
handle-blocked-listener-exception-fn
handle-consumer-exception-fn
handle-connection-recovery-exception-fn
handle-channel-recovery-exception-fn
handle-topology-recovery-exception-fn]}]
(proxy [ForgivingExceptionHandler] []
(handleUnexpectedConnectionDriverException [^Connection conn ^Throwable t]
(reify ExceptionHandler
(handleUnexpectedConnectionDriverException [_ conn throwable]
(when handle-connection-exception-fn
(handle-connection-exception-fn conn t)))
(handleReturnListenerException [^Channel ch ^Throwable t]
(handle-connection-exception-fn conn throwable)))
(handleReturnListenerException [_ channel throwable]
(when handle-return-listener-exception-fn
(handle-return-listener-exception-fn ch t)))
(handleFlowListenerException [^Channel ch ^Throwable t]
(when handle-flow-listener-exception-fn
(handle-flow-listener-exception-fn ch t)))
(handleConfirmListenerException [^Channel ch ^Throwable t]
(handle-return-listener-exception-fn channel throwable)))
(handleConfirmListenerException [_ channel throwable]
(when handle-confirm-listener-exception-fn
(handle-confirm-listener-exception-fn ch t)))
(handleBlockedListenerException [^Connection conn ^Throwable t]
(handle-confirm-listener-exception-fn channel throwable)))
(handleBlockedListenerException [_ conn throwable]
(when handle-blocked-listener-exception-fn
(handle-blocked-listener-exception-fn conn t)))
(handleConsumerException [^Channel ch ^Throwable t
^Consumer consumer ^String consumer-tag
^String method-name]
(handle-blocked-listener-exception-fn conn throwable)))
(handleConsumerException [_ channel throwable consumer consumer-tag method-name]
(when handle-consumer-exception-fn
(handle-consumer-exception-fn ch t consumer consumer-tag method-name)))
(handleConnectionRecoveryException [^Connection conn ^Throwable t]
(handle-consumer-exception-fn channel throwable consumer consumer-tag method-name)))
(handleConnectionRecoveryException [_ conn throwable]
(when handle-connection-recovery-exception-fn
(handle-connection-recovery-exception-fn conn t)))
(handleChannelRecoveryException [^Channel ch ^Throwable t]
(handle-connection-recovery-exception-fn conn throwable)))
(handleChannelRecoveryException [_ channel throwable]
(when handle-channel-recovery-exception-fn
(handle-channel-recovery-exception-fn ch t)))
(handleTopologyRecoveryException [^Connection conn ^Channel ch
^TopologyRecoveryException t]
(handle-channel-recovery-exception-fn channel throwable)))
(handleTopologyRecoveryException [_ conn channel tre] ;; TopologyRecoveryException
(when handle-topology-recovery-exception-fn
(handle-topology-recovery-exception-fn conn ch t)))))
(handle-topology-recovery-exception-fn conn channel tre)))
)
)

;;
;; Implementation
Expand All @@ -299,11 +295,10 @@

(defn- platform-string
[]
(let []
(format "Clojure %s on %s %s"
(clojure-version)
(System/getProperty "java.vm.name")
(System/getProperty "java.version"))))
(format "Clojure %s on %s %s"
(clojure-version)
(System/getProperty "java.vm.name")
(System/getProperty "java.version")))

(def ^{:private true}
client-properties {"product" "Langohr"
Expand Down Expand Up @@ -351,9 +346,8 @@
(when sasl-config
(.setSaslConfig cf sasl-config))
(when ssl-context
(do
(.useSslProtocol cf ^javax.net.ssl.SSLContext ssl-context)
(.setPort cf port)))
(.useSslProtocol cf ^javax.net.ssl.SSLContext ssl-context)
(.setPort cf final-port))
(when verify-hostname
(.enableHostnameVerification cf))
(when thread-factory
Expand Down
Loading

0 comments on commit e4c9096

Please sign in to comment.