Meteor-Community-Packages / meteor-publish-composite

Meteor.publishComposite provides a flexible way to publish a set of related documents from various collections using a reactive join
https://atmospherejs.com/reywood/publish-composite
MIT License
553 stars 58 forks source link

Turning off reactivity for specific publications #50

Closed rfines closed 9 years ago

rfines commented 9 years ago

First off, I really like this package and use it liberally. My only problem with it right now is that I am running into a case where I need to subscribe to a composite publication but I don't want it to update when I update documents. Here is a breakdown of my use case:

I have a platform that is built as a collection of microservices, one of the services controls all access to the data through publications. The other services, which are all meteor apps, then subscribe to this data using a DDP connection and they loop over the published data to do some processing on the documents on a scheduled basis. Because the publications are reactive, the methods that do the processing never stop running because the publication continually updates the subscription when I update one of the top level documents.

I was wondering if there is a way to add an option to turn reactivity off for specific subscriptions or publications? Or maybe this is already possible?

Thanks

reywood commented 9 years ago

Sounds like you should be using a method rather than a publication. Publications are made to be reactive. If you don't want/need reactivity you will use less server resources with a method.

rfines commented 9 years ago

I actually tried to go that way to begin with but after some research I found that I had to subscribe to the data from the other services or there wasn't any data available to the service. I will do some more playing around with it and see if I can figure out what I can do.