anuaralfetahe

anuaralfetahe

Blockade - event dispatching with priority levels

Hey there BEAM community!

I’m happy to share with you my latest creation. Erlang library called Blockade. This library was born out of a personal need and a desire to improve event handling in Erlang/Elixir projects. After searching for existing solutions, I found that nothing quite all my requirements. There are many nice libraries such as Phoenix PubSub but they do not offer event filtering. So, I rolled up my sleeves and developed Blockade.

Main features

  • Subscribe to events
  • Dispatch events
  • Filter events by priority level
  • Discard events by priority level

Blockade is built on top of Erlang pg module which actually does the heavy lifting and provides the distributed features meaning events can be dispatched to all subscribers in the Erlang cluster, subscribers (processes) who die will be automatically removed from the subscribers list.

A Real-World Use Case

Let me share a real-world scenario where Blockade shines. Imagine you have a system processing critical transactions. During this time, you need to ensure that no other transactions are processed concurrently, as it could lead to inconsistencies. By leveraging Blockade, you can simply set a higher priority level on the event queue, effectively creating a blockade that locks all resources. This way, any other events in the queue will wait until the transaction processing is complete. Once the transaction finishes, resetting the priority level will automatically unleash the queued events.

https://github.com/alfetahe/blockade

Happy coding!

Where Next?

Popular in Announcing Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36689 110
New
Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_orde...
New
mathieuprog
Hello :waving_hand: Allow me to introduce you to Tz, an alternative time zone database support to Tzdata. Why another library? First a...
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: GitHub - tmbb/phoenix_ws: Websockets implemented over Phoenix Ch...
New
Qqwy
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects. Core ideas Type- and function specifications are const...
336 14713 100
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130579 1222
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44608 311
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44167 214
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement