Тёмный

Clojure Queues with RabbitMQ 

Daniel Amber
Подписаться 3,9 тыс.
Просмотров 2,2 тыс.
50% 1

Опубликовано:

 

13 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 12   
@TomasBrejla
@TomasBrejla 3 года назад
Regarding closing channel/connection... Using `with-open` macro might be a way better option than manually closing the channel and connection. `with-open` has a `let`-like form and automatically surrounds the expression in itself with a try-finally block, in which it pefrorms the closing for you. The object to be closed doesn't have to implement `java.io.Closable`, it just needs to have a .close() method on itself. Therefore it can be used for both `rmq/connect` connection (which is Closable) and for `lch/open` channel (it isn't Closable, but has .close() method). Here's an example: ``` (with-open [conn (rmq/connect) ch (lch/open conn)] (println "connection and channel open for 5 secs") (Thread/sleep 5000) (println "connection and channel will be closed even after exception") (throw (ex-info "boom!" {}))) ``` And here is what it macroexpands to: ``` (clojure.walk/macroexpand-all '(with-open [conn (rmq/connect) ch (lch/open conn)] (println "connection and channel open for 5 secs") (Thread/sleep 5000) (println "connection and channel will be closed even after exception") (throw (ex-info "boom!" {})))) ;; => (let* ;; [conn (rmq/connect)] ;; (try ;; (let* ;; [ch (lch/open conn)] ;; (try ;; (do ;; (println "connection and channel open for 5 secs") ;; (. Thread sleep 5000) ;; (println "connection and channel will be closed even after exception") ;; (throw (ex-info "boom!" {}))) ;; (finally (. ch clojure.core/close)))) ;; (finally (. conn clojure.core/close)))) ```
@eugenej.5584
@eugenej.5584 3 года назад
Yeah with-open is a good example how Lisp syntax allows to allocate variables and resources in a scope with auto collect/release.
@onthecodeagain
@onthecodeagain 3 года назад
Yeah thats much nicer :) thanks!!
@SebastianAnklamm
@SebastianAnklamm 2 года назад
I am always amazed how much well digestible content you are able to pack into 15 minutes. Top notch as always.
@onthecodeagain
@onthecodeagain 2 года назад
Woah thanks for the awesome words man!
@ScottRehorn
@ScottRehorn 2 года назад
Excellent stuff! Nice pacing and well-thought out presentation - keep up the good work. ps I hope you hit your 1k subs! You are soooo close :)
@eugenej.5584
@eugenej.5584 3 года назад
Kafka next? :D
@onthecodeagain
@onthecodeagain 3 года назад
Mayybee??
@eugenej.5584
@eugenej.5584 3 года назад
@@onthecodeagain I think it's trending this days. A lot of channels make videos about Kafka.
@onthecodeagain
@onthecodeagain 3 года назад
@@eugenej.5584 Ive never used it before but ive always want to learn it so I think it will be be a fun one to do. Do you use it?
@eugenej.5584
@eugenej.5584 2 года назад
@@onthecodeagain Haven't used it in production myself but I heard from multiply developers of high load distributed systems complains about RabbitMQ and that it is hard to make Rabbit work reliably and as a result they switching to Kafka with no regrets :P Main point seems to be that Kafka is fast and has immutable message log that allows you to track bugs without pointing fingers at each other :D Besides, latest Kafka releases don't need Zookeeper (seems to be the biggest pain point). An CTO of e-comers chain said that they avoid big part of Kafka complexity by using singe partition per topic and singe provider per topic. This way you know who writes messages and they all ordered (order between partitions not guaranteed). Also *Redpanda* seems to be an interesting project.
@onthecodeagain
@onthecodeagain 2 года назад
@@eugenej.5584 I'll check out redpanda, I've never used Kafka before so have been doing a bit of research seems to be a nice alternate to RabbitMQ :) think it will make for a promising demo.
Далее
Clojure tutorial - Create a rate limiting function!
20:17
Вопрос Ребром - Булкин
59:32
Просмотров 1,1 млн
Сколько стоят роды мечты?
00:59
Просмотров 139 тыс.
OG Buda, Слава КПСС - LAZER SLAVA
01:58
Просмотров 59 тыс.
Clojure Tutorial - Thread Safety with Atoms!
24:57
Просмотров 1,6 тыс.
Clojure core.async tutorial (part 1)
16:55
Просмотров 3,4 тыс.
Clojure Syntax - The odd bits
14:01
Просмотров 6 тыс.
Clojure maps! Everything you need to know!
12:55
Просмотров 3,7 тыс.
Create a URL shortner with Clojure and MySQL
36:59
Просмотров 4,8 тыс.
Rust Data Modelling Without Classes
11:25
Просмотров 172 тыс.
Вопрос Ребром - Булкин
59:32
Просмотров 1,1 млн