I've started building an analytical dashboard for Bitshares/Openledger (similar to steempunks and will be open sourcing Elixir libraries along the way. This release adds a simple subscription interface by integrating GenStage, a specification for handling and exchanging events.
Repo and package
Changelog
- Graphene.Stages.Supervisor module
- Graphene.Stages.Blocks.Producer module
- example of GenStage blocks consumer
- config option to start Stages.Supervisor process
- minor code style improvements and bugfixes
GenStage client example
defmodule Graphene.Stage.Blocks.ExampleConsumer do
use GenStage
require Logger
alias Graphene.Block
def start_link(args, options \\ []) do
GenStage.start_link(__MODULE__, args, options)
end
def init(args) do
{:consumer, args, subscribe_to: args[:subscribe_to]}
end
def handle_events(events, _from, state) do
block = hd(events)
for tx <- Block.unpack_txs(block) do
Logger.info """
New transaction:
#{inspect tx}
"""
end
{:noreply, [], state}
end
end
About Elixir
Elixir is a functional programming language with superior concurrency primitives, distributed computation and fault tolerance capabilities based on Erlang/OTP.
Personally, I am really happy with my bet on Elixir to build cryptotokens related apps and strongly recommend every developer to try it.
Learning resources:
- ElixirConf Jose Valim Keynote
- ElixirConf 2016 Chris McCord Keynote
- Elixir School
- Elixir Crash Course
Roadmap
- Next: assets and feeds
- More utility functions
Implement subscriptionsInvestigate PubSub implementations- More tests and docs