Abdulrazak-Alkl / activemessaging

Automatically exported from code.google.com/p/activemessaging
0 stars 0 forks source link

poller.rb does not work correctly out of the box #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Steps to reproduce:
-------------------
1. Follow the instructions at
http://code.google.com/p/activemessaging/wiki/TenMinuteIntroduction,
exactly as written there.
2. At the end, it says "Now, to begin consuming the queue, start the
poller.rb script". I ran it from "vendor\plugins\activemessaging" directory.

Expected Behavior and Actual Behavior
--------------------------------------
The processor is expected to display the message on the console. Instead,
it  does the following:
------------------------------------------------
>ruby poller.rb
Loading ./../../..//app/processors/item_listing_processor.rb
No subscriptions.
Create a file named 'config/subscriptions.rb'.
Start with an example by executing:
  cp vendor/plugins/activemessaging/subscriptions.rb.example
config/subscription
s.rb (on Mac/Unix)
  copy vendor/plugins/activemessaging/subscriptions.rb.example
config/subscripti
ons.rb (on Windows)
(Yes, I'll handle this better later on.)
----------------------------------------------

This seems to be due to omission of the following line from the file
"plugins/activemessaging/generators/processor/templates/processor.rb"

  subscribes_to :item_listings

Add this line to the template and now you get the following error:
----------------------------------------------
>ruby poller.rb
Loading ./../../..//app/processors/item_listings_processor.rb
./../../..//vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:84:in
`find_queue': You have not yet defined a queue named item_listings. Queues
curre
ntly defined are [] (RuntimeError)
        from
./../../..//vendor/plugins/activemessaging/lib/activemessaging/gate
way.rb:93:in `subscribe_to'
        from
./../../..//vendor/plugins/activemessaging/lib/activemessaging/proc
essor.rb:28:in `subscribes_to'
        from ./../../..//app/processors/item_listings_processor.rb:3
        from
C:/software/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-
1.3.1/lib/active_support/dependencies.rb:140:in `load'
        from
C:/software/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-
1.3.1/lib/active_support/dependencies.rb:140:in `load'
        from poller.rb:4
        from poller.rb:4:in `each'
        from poller.rb:4
------------------------------------------------------

This seems to happen because the queue definitions are not loaded.
Add the following line to poller.rb to make it work:

load RAILS_ROOT + 'config/messaging.rb'

Now everything works as expected.

Original issue reported on code.google.com by neeraja...@gmail.com on 14 Jan 2007 at 3:28

GoogleCodeExporter commented 8 years ago
I changed the wiki to include the subscribes_to step.

Some of this is a dupe of another issue, though with more details about the 
exact
error to load the subscriptions.rb file...

I did not need to add loading messaging.rb - this is done in the init.rb of the
plugin, should not need to do this, but I'll try to reproduce.

Also, the correct way to start the poller is the rake task (at least for the 
moment),
so I added that to the wiki instructions as well.

Thanks 
-Andrew

Original comment by kooks...@gmail.com on 14 Jan 2007 at 10:16

GoogleCodeExporter commented 8 years ago
Fixed the error message.

Also fixed the generator to add a queue definition to app/config/messaging.rb 
and a
subscribes_to call to generated processors.

Did not need to add loading config/messaging.rb, as this is loaded by init.rb - 
could
not reproduce this error, never needed to add that line to get the poller.rb to 
work.

Testing, will check in soon.

Original comment by kooks...@gmail.com on 16 Jan 2007 at 5:37

GoogleCodeExporter commented 8 years ago
fixed in svn v. 31

Original comment by kooks...@gmail.com on 17 Jan 2007 at 5:12

GoogleCodeExporter commented 8 years ago
found where the messaging.rb needs to be loaded - oddly, when running from 
rake, not
a problem, but when running calling poller.rb directly it id missing. Odd, 
gonna do
more research, in the meantime I am adding the call to load messaging.rb to the
poller.rb script.

Original comment by kooks...@gmail.com on 18 Jan 2007 at 6:20