Cizen is a library that supports building concurrent applications in Elixir. In this post, we try to start a million sagas and fire a million events with them.

For our example, I introduce a saga we’ll define, RelaySaga, and Relay event, which has two fields message and number. RelaySaga is started with a number parameter and works as described below.

If the given number is 0, RelaySaga:

  • subscribes Relay event whose number field is 0.
  • on Relay event, outputs the message field of the Relay event.

Otherwise, RelaySaga:

  • subscribes Relay event whose number field is the same as the given…

Cizen is a library to build concurrent applications with a collection of automata which communicate with each other by events. In this post, we are going to create an application to do concurrent image processing with saving our CPU resource. In addition, we’ll do it by combining existing CLI tools.

To prepare the development, create your mix project;

mix new cizen_example
cd cizen_example

and add cizen into your deps in mix.exs:

defp deps do
{:cizen, "~> 0.12.5"}

Then, run mix deps.get.

Also, we prepare the following mock CLI tools, and is a CLI tool…

Cizen is an Elixir library to build applications with collections of sagas. Sagas communicate with each other by subscribing and dispatching events. In this post, we’re going to dive into the deep inside of the mechanism of event subscription and dispatching.

First, we should know about filters. Each subscription has one filter which represents an event pattern to subscribe. We can create a filter like this:

# A filter for `Join` events to the Lobby. %Event{body: %Join{room: room}} ->
room == "Lobby"

Next principal is an event router. An event router is a system component that lists subscribers…

Do you know redux-pages? I guess you don’t know, so I’d like to give a description. Briefly, the reason to use redux-pages is to keep our application state clean. Only we want to know from the state is “what page is rendered?”, and not the page path.

Paths don’t tell us what page should be rendered. In other words, paths tell us what page will/may be rendered. For example, suppose we visit a page `/cart/estimate` which shows an estimated shipment date and a cost of goods in a shopping cart. The date and cost may be calculated on server-side and…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store