Abdulrazak-Alkl / activemessaging

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

processors subscribed to same topic don't get called #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  create two processors that subscribe to the same topic
2.  publish a message to a topic
3.  Only the processor that has a class name that is alphabetically first is 
called

The reason why this is happens is because the dispatch_next will dispatch 
blindly on any message 
received.  In the dispatch method, subscriptions.first is called, which returns 
the first subscription 
everytime.

Original issue reported on code.google.com by bryanli...@gmail.com on 28 Dec 2006 at 9:00

GoogleCodeExporter commented 8 years ago
to get around this issue, i added to following to beginning of 
ActiveMessaging.dispatch:

        # if we have seen this message before, discard it
        @@messages ||= []
        if @@messages.include?(message.headers['message-id'])
          return
        end
        @@messages << message.headers['message-id']

Original comment by bryanli...@gmail.com on 28 Dec 2006 at 9:09

GoogleCodeExporter commented 8 years ago
Good defect - I was able to reproduce.
I think there may be an easier fix.
The subscribers were being searched on getting a message by calling 'find' (not
'first') which only processes the first subscription that matches.

I got it to work correctly by changing the 'find' to an 'each' - so it tests all
subscribed processors, even if it gets multiple matching subscriptions.  I'll be
including this somewhat different way of fixing this problem in the next 
release.

Original comment by kooks...@gmail.com on 16 Jan 2007 at 7:01

GoogleCodeExporter commented 8 years ago
Fixed in svn version 31, see comment 2 for fix detail

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