Barenboim

Conejo

hex.pmhexdocs.pmBuild Status

Barenboim is prepared to tackle with data streaming dependencies in concurrent flows.

If your application works with a data streaming and your incoming events could have dependencies between them, the app can have problems about when the dependency data is ready. Reasons:

Installation

Configuration

You can also configure a delay for a reminder notification. A reminder notification is sent in order to avoid corner cases (notification between the data access and the registration of a dependency). This time (milliseconds) should be defined depending on your data access function time (see next section).

```elixir
config :barenboim,
  reminder_time: 50     # default 100
```

How to use it

Define the function that will retrieve the dependency data where dependency_id is the id of your data and call Barenboim.get_data. You can also specify a time out in milliseconds.

  fun = fn(dependency_id) -> MyDataModule.get(dependency_id) end
  {:ok, data} = Barenboim.get_data(dependency_id, fun)

Meanwhile, the flow that is processing a new event has to notify when the data is available for others.

    Barenboim.notify(dependency_id)

Or you can even attach the data:

    Barenboim.notify({dependency_id, dependency_data})

Test

In honor of

Daniel Barenboim