Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions

in #bitshares7 years ago


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:

Roadmap

  • Next: assets and feeds
  • More utility functions
  • Implement subscriptions
  • Investigate PubSub implementations
  • More tests and docs
Sort:  

Very cool! So we'll be able to use this to create bitshares blockchain explorers? Looking forwards to future releases :)

good, i need programmer who will create for me a website with good idea, where I can find prgrammers that are ready to cooperate ?

I'm a web developer ;-)

the guy's name is clixmoney. lol.

Don't even need to email him. Already know his idea of a website :P
Let people clixxx on ads and pay out in bitcoin... just a guess.

I don't like email, we can talk here.

why website? let's make it native for iOS / android?

nice....your post deserve my upvote and resteem....

How different is Elixir from Erlang? I have to learn Erlang for a project, will I be able to make the switch easily?

Syntax is quite different, semantics are mostly the same. There are minor differences like order of arguments for some functions though. Anyway, you will be able to make the switch with an adequate amount of effort. I also that learning two languages with different syntax but very similar semantics is a great learning exercise :)

Looks very cool! Always glad to see more useful Elixir projects.

interesting one man.. @ontofractal keep going

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64093.86
ETH 3123.80
USDT 1.00
SBD 3.94