Ruby Client Support
For detailed information on the Ruby SDK and its functionalities, refer to the Ruby SDK README.
Instrumentation
Start with the instrumentation guide if you haven’t already. It will walk you through the process of setting up Streamdal and its components.
Getting Started
- Install the gem
gem install streamdal
Prerequisites
- Ruby 3.0.0 or higher
Example
Here’s a basic example of how to use the Ruby SDK:
require 'streamdal'
# Create a new client
logger = Logger.new(STDOUT)
logger.level = Logger::INFO
client = Streamdal::Client.new({
streamdal_url: "localhost:8082",
streamdal_token:"1234",
service_name: "demo",
log: logger,
dry_run: false
})
# Define the audience
audience = Streamdal::Audience.new(Streamdal::OPERATION_TYPE_CONSUMER, "consume", "kafka-consumer")
while true
sleep(2)
resp = client.process('{"email": "[email protected]"}', audience)
puts "Response: "
puts "-----------------------------------"
puts resp.inspect.gsub(/\\n/, "\n")
puts "-----------------------------------"
end
This example demonstrates how to initialize a new instance of the Streamdal SDK, and how to process data through a method call.
A more full-featured demo is located within the Ruby SDK
Libraries
Along with additional language support, we plan forking specific libraries that would be impactful to have the Streamdal functionality. Read more about our Libraries/Shims.
Below are some additions we are considering based on feedback from our design partners and current users:
Messaging Systems | Database |
---|---|
rdkafka-ruby | ruby-pg |
bunny | mong-ruby-driver |
rest-client | sqlite3-ruby |
graphql-ruby | activerecord |
http.rb | redis-rb |
nats.rb | grape |
Think we should consider or prioritize other libraries?
Join our discord and participate in the polls! The discussions and feedback our users and the open source community brings will be incredibly value to feature development.
For more information on the progress for Ruby support, check out our roadmap