{"id":16977366,"url":"https://github.com/mryslab/rb_banyan","last_synced_at":"2026-04-17T03:03:37.699Z","repository":{"id":56891057,"uuid":"126042158","full_name":"MrYsLab/rb_banyan","owner":"MrYsLab","description":"A ruby version of the Banyan Framework. Comptabile with Python Banyan","archived":false,"fork":false,"pushed_at":"2023-08-08T16:13:19.000Z","size":398,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-18T20:49:35.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrYsLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-20T15:43:02.000Z","updated_at":"2024-10-10T14:28:39.000Z","dependencies_parsed_at":"2024-11-28T05:34:01.603Z","dependency_job_id":null,"html_url":"https://github.com/MrYsLab/rb_banyan","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"71b7de62822a55ad29424ec120f1706471e58cf2"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Frb_banyan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Frb_banyan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Frb_banyan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Frb_banyan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrYsLab","download_url":"https://codeload.github.com/MrYsLab/rb_banyan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244875046,"owners_count":20524591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T01:28:48.179Z","updated_at":"2026-04-17T03:03:35.071Z","avatar_url":"https://github.com/MrYsLab.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# RbBanyan\nThis is the ruby compatible version of the [Python Banyan Framework](https://mryslab.github.io/python_banyan/).\n\nBanyan is a lightweight, reactive framework used to create flexible, non-blocking, \nevent driven, asynchronous applications. It was designed primarily to \nimplement physical computing applications for devices such as the \nRaspberry Pi and Arduino, but it is not limited to just the physical computing domain, \nand may be used to create applications in any domain.\n\nBanyan applications are comprised of a set of components, each component being a seperate process. \nComponents communicate with each other by publishing and subscribing to language independent protocol messages.\nAs a result, any component can communicate with any other component, regardless of computer language.\nEach Banyan component connects to a common Banyan backplane that distributes published messages to all message\nsubscribers. The backplane is provided as a command line executable as part of this package and is invoked with\n\n```apple js\nrb_backplane\n```\nThe backplane must be started before invoking any Banyan component.\n\nIn addiition, there is a command line backplane provided as part of the package to monitor all traffic\ngoing across the backplane.\n\nTo invoke the monitor, type:\n```apple js\nrb_monitor\n```\n\n## Installation\n\n\n    $ gem install rb_banyan\n\n## banyan_base.rb API\n![](https://github.com/MrYsLab/rb_banyan/blob/master/images/banyan_base_api.png)\n\n## A Simple Echo Server\n```\nrequire 'rb_banyan/banyan_base.rb'\n\nclass SimpleEchoServer \u003c BanyanBase\n\n  def initialize\n    # set the process name for the console banner\n    super(process_name: 'SimpleEchoServer')\n    \n    # allow time for zmq connections to complete\n    sleep(0.3)\n\n    # set the subscriber topic\n    set_subscriber_topic('echo')\n\n    # wait for messages to arrive\n    begin\n      receive_loop\n    rescue SystemExit, Interrupt\n      clean_up\n    end\n  end\n\n  # process incoming messages - just resend the payload with\n  # a topic of 'reply'\n  def incoming_message_processing(_topic, payload)\n    publish_payload(payload, 'reply')\n  end\nend\n\n\nSimpleEchoServer.new\n\n```\n## A Simple Echo Client\n\n```\nrequire 'rubygems'\nrequire 'rb_banyan/banyan_base.rb'\n\n# This is a simple echo client. It sends out a series of messages and expects an\n# echo reply from the server\n\n# To use: 1. Start the backplane.\n#         2. Start the server.\n#         3. Start this client.\n\nclass SimpleEchoClient \u003c BanyanBase\n\n  def initialize\n\n    # set the process name for the console banner\n    super(process_name:'SimpleEchoClient')\n\n    # allow time for zmq connections to complete\n    sleep(0.3)\n\n    # initialize the number of messages to send and receive\n    @number_of_messages = @message_number = 10\n\n    # set the subscriber topic\n    set_subscriber_topic('reply')\n\n    # send the first message\n    publish_payload({'message_number': @message_number}, 'echo')\n\n    # adjust the message number for the next send\n    @message_number -= 1\n\n    # get the reply messages\n    # wait for messages to arrive\n    begin\n      receive_loop\n    rescue SystemExit, Interrupt\n      clean_up\n    end\n  end\n\n  # With each incoming message, adjust the message number and \n  # publish the next message until the count is achieved.\n  def incoming_message_processing(_topic, payload)\n    # if all messages received, we are done.\n    if payload['message_number'] == 0\n        puts('All messages sent and received')\n        clean_up\n        exit(0)\n\n    # we have more to send - bump the message number and send the message out\n    else\n      @message_number -= 1\n      publish_payload({'message_number': @message_number}, 'echo')\n    end\n  end\nend\n\nSimpleEchoClient.new\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmryslab%2Frb_banyan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmryslab%2Frb_banyan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmryslab%2Frb_banyan/lists"}