I think there is a bug somewhere or I am doing something wrong O-o Which is weird because it's just copy paste from the examples.
The server should output 20 times the message. But i doesn't do it. Some times it does, some times it doesn't.
If I call the method like *_block then everything is ok. The problem is when is it just the plain call, without waiting for return.
I tried the same code in ruby 1.9 and 1.8 with similar results.
Server:
require "brb"
class ExposedCoreObject
def simple_api_method(parameter)
puts " > Receive #{parameter} in the main ruby process"
end
end
EM::run do # Start event machine
# Start BrB Service, expose an instance of core object to the outside world
BrB::Service.start_service(:object => ExposedCoreObject.new, :host => 'localhost', :port => 5555)
end
Client
require 'brb'
# Create a communication tunnel to the core process
# nil as first parameter as we do not expose any object in exchange
core = BrB::Tunnel.create(nil, "brb://localhost:5555",:verbose => true)
20.times do |t|
core.simple_api_method('20')
end