harold

harold - crystal library for in-process pub-sub communication.

harold

harold - crystal library for in-process pub-sub communication.

Installation

Add this to your application's shard.yml:

dependencies:
  harold:
    github: waterlink/harold

Usage

require "harold"

Harold.start

Publishing

Harold.publish(topic :: String, "message")

NOTE: topic is expected to be a valid crystal identifier.

NOTE: :: {{Type}} part after topic name is the type annotation for message.

Subscribing

spawn do
  Harold.subscribe(topic :: String).each do |message|
    puts "Someone said: #{message}"
  end
end

NOTE: topic is expected to be a valid crystal identifier.

NOTE: :: {{Type}} part after topic name is the type annotation for message.

Development

After cloning the project:

  • Use crystal deps or shards to install development dependencies.
  • Use crystal spec to run tests.
  • Use TDD.

Contributing

  1. Fork it ( https://github.com/waterlink/harold/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • waterlink Oleksii Fedorov - creator, maintainer
Repository

harold

Owner
Statistic
  • 0
  • 1
  • 0
  • 0
  • 1
  • about 9 years ago
  • October 24, 2015
License

MIT License

Links
Synced at

Wed, 06 Nov 2024 23:37:52 GMT

Languages