this was a server product that was shut down years ago
security holes are building up and i don't feel like fixing them because there's nothing to connect to
don't use this code
Atom-Ruby is the official ironSource.atom SDK for the Ruby programming language.
$ gem install iron_source_atom-1.1.0.gem
You may use SDK in two different ways:
- High level Tracker - contains in-memory storage and tracks events based on certain parameters.
- Low level - contains 2 methods: putEvent() and putEvents() to send 1 event or a batch respectively.
require 'thread'
require 'json'
require 'iron_source_atom'
class TestTracker
def self.test_multitread
url = "http://track.atom-data.io/"
atom_tracker = IronSourceAtom::Tracker.new
atom_tracker.auth = ""
a=0
run_example = true
(0..5).each do |int|
Thread.new do
begin
while run_example
data = {
id: a += 1,
message: "#{int}Thread_array_data"
}.to_json
atom_tracker.track(data, "ibtest")
puts "send data #{data}"
sleep(0.05)
if a > 100
run_example = false
end
end
end
end
end
sleep 30
end
test_multitread
end
The Tracker process:
You can use track() method in order to track the events to an Atom Stream. The tracker accumulates events and flushes them when it meets one of the following conditions:
- Flush Interval is reached (default: 10 seconds).
- Bulk Length is reached (default: 4 events).
- Maximum Bulk size is reached (default: 64kB).
In case of failure the tracker will preform an exponential backoff with jitter. The tracker stores events in a memory storage based on Queue.
require 'json'
require 'iron_source_atom'
class TestExample
def self.do_test_job
url = "http://track.atom-data.io/"
auth = ""
atom = IronSourceAtom::Atom.new(auth)
data_string = {
id: 1,
message: "hello_from_ruby"
}.to_json
response = atom.put_event("ibtest", data_string)
puts "Response #{response.code} #{response.message}:
#{response.body}"
data1 = {
id: 11,
message: "first_array_data"
}
data2 = {
id: 12,
message: "second_array_data"
}
data3 = {
id: 13,
message: "third_array_data"
}
array_data_string = [data1, data2, data3].to_json
response = atom.put_events("ibtest", array_data_string)
puts "Response #{response.code} #{response.message}:
#{response.body}"
end
do_test_job
end
You can use our example for sending data to Atom: