tongueroo / ticker-app-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a demo app to help me answer some quetions.

SETUP:
$ ruby ticker_talker.rb # to start pushing data to port 9100
$ ruby ticker_listener.rb # to start processing data from port 9100

# At this point, ticker_lister.rb is using nanite to add messages to the exchange.  However, no nanite agents have been started.

$ cd ticker_agent
$ nanite -t ticker # start the nanite agent to process off the exchange.

QUESTION:
So when i call Nanite.request("/ticker/handle", data) to an agent
if there are zero agents running, it seems that those requests get lost
is that the way its supposed to work?  i thought that Nanite.request("/ticker/handle", data) will save the requests into a queue (the exchange) and whenever i fire up my nanite actors later, it will pick it up from the exchange, and not lose the requests...

Thanks careo for answering this.  Currently nanite mapper send requests directly to the nanite actors so and there is no check to see if there is zero nanite actors runnning. 


######################################################################

QUESTON2:
10:30 tongueroo: so if i some of the actors require dependencies, do i have to require the dependencies where i call the mapper also, Nanite.start  

SETUP2:
1. start ticker talker, this sends data to host: localhost, port 9600 every second
tung@walle ~/Sites/br/ticker_app/lib $ ruby ticker_talker.rb 
sending data : <data>scores</data>
sending data : <data>scores</data>

2. start nanite actor agent, this is the worker that will handle the data that will be passed onto it from ticker_listener
tung@walle ~/Sites/br/ticker_app/lib/nanite_agents $ nanite

3A. start ticker listener to process the data that is being sent from ticker_talker, with the required dependencies commented out
tung@walle ~/Sites/br/ticker_app $ ./bin/ticker 
starting ticker listener...
done operating on the data
done operating on the data
...
done operating on the data
/opt/local/lib/ruby/gems/1.8/gems/nanite-0.2.0/lib/nanite/marshal.rb:17:in `load': undefined class/module Processor:: (ArgumentError)
        from /opt/local/lib/ruby/gems/1.8/gems/nanite-0.2.0/lib/nanite/marshal.rb:17:in `load_packet'
        from /opt/local/lib/ruby/gems/1.8/gems/nanite-0.2.0/lib/nanite/mapper.rb:200:in `setup_queues'
        from /opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.0/lib/mq/queue.rb:375:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.0/lib/mq/queue.rb:375:in `receive'
        from /opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.0/lib/mq.rb:171:in `process_frame'
        from /opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.0/lib/amqp/client.rb:9:in `process_frame'
        from /opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.0/lib/amqp/client.rb:105:in `receive_data'
        from /opt/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.2/lib/eventmachine.rb:231:in `run_machine'
        from /opt/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.2/lib/eventmachine.rb:231:in `run'
        from ./bin/ticker:36
tung@walle ~/Sites/br/ticker_app $ 


3B. start ticker listener to process the data that is being sent from ticker_talker, with the required dependencies NOT commented out
tung@walle ~/Sites/br/ticker_app $ ./bin/ticker 
starting ticker listener...
done operating on the data
done operating on the data
done operating on the data
done operating on the data
done operating on the data
d862f0a68ecb2371e87d47b60c7cea0cProcessor::Generic
done operating on the data
d862f0a68ecb2371e87d47b60c7cea0cProcessor::Generic
done operating on the data
d862f0a68ecb2371e87d47b60c7cea0cProcessor::Generic
done operating on the data
d862f0a68ecb2371e87d47b60c7cea0cProcessor::Generic
done operating on the data
d862f0a68ecb2371e87d47b60c7cea0cProcessor::Genericdone operating on the data
d862f0a68ecb2371e87d47b60c7cea0cProcessor::Generic




So, I get that error that Processor is not defined and it looks like its coming form the mapper Nanite.start call in 
lib/ticker_listener.rb:14:    @@started ||= Nanite.start :mapper => true, :host => 'localhost',

What whenever I uncomment out there require for the dependencies in the ticker_listener.rb
lib/ticker_listener.rb:8: require here + "/processor/manager"
lib/ticker_listener.rb:9: require here + "/processor/generic"
Then I dont get this error.

About


Languages

Language:Ruby 100.0%