meteor / redis-livedata

Realtime data-sync support for Redis in Meteor
https://atmospherejs.com/package/redis-livedata
147 stars 17 forks source link

serverside matching and observer #3

Open manuel-schoebel opened 10 years ago

manuel-schoebel commented 10 years ago

I just can't figure out what is wrong here :(

I plan to implement a TaskManager that listens to mongodb with observe changes. If s.th. is added to a Mongo Collection, the TaskManager would add a task to the Redis Collection. Another process/worker would listen to redis and process the task. All on the server only!

// my RedisCollection
@Redis  = new Meteor.RedisCollection('redis')

// adding to Redis e.g.: jobqueue:Order:odmbRek9wCTjbboRj
Redis.set "jobqueue:#{type}:#{key}", key

// console output:
Redis keyspace event: jobqueue:Order:odmbRek9wCTjbboRj: set

Another meteor process, also connected to the redis db then listens to the jobqueue:

Redis.matching("jobqueue:*").observe({
  added: (doc) ->
    console.log 'something added'
})

My problem is, that the console log of the added callback never shows up. Instead I only get this log:

Redis (__keyspace@*) notification: __keyspace@0__:jobqueue:Order:odmbRek9wCTjbboRj: set
Redis keyspace event: jobqueue:Order:odmbRek9wCTjbboRj: set

Is there any known issue on using this server side only? Or do I something wrong, from what I posted here?

Any help would be highly appreciated :)

Thanks Manuel

justinsb commented 10 years ago

I think we might have a bug with observe (as opposed to observeChanges) - I'm digging into it.

In the meantime, you might see if observeChanges works for you.

manuel-schoebel commented 10 years ago

Oh yes, observeChanges looks better. I will start from there on, thx a lot! :)

wearhere commented 9 years ago

I can confirm that observe simply does not work, in the sense that its callbacks are never called–whereas observeChanges works just fine. May I suggest renaming this issue accordingly? I'd also be curious to hear your initial findings on its cause @justinsb / your progress on resolving it–I see that you had a WIP.