harold
harold - crystal library for inter-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
orshards
to install development dependencies. - Use
crystal spec
to run tests. - Use TDD.
Contributing
- Fork it ( https://github.com/waterlink/harold/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- waterlink Oleksii Fedorov - creator, maintainer