Quoting Ronnie Nessa <[email protected]>: > Den 7. des. 2010 kl. 17.10 skrev Paul Merlin: > > Quoting Ronnie Nessa <[email protected]>: > >> In my application I have a re-indexer service that under certain > >> conditions reindexes the entire database when the application is > >> started ( I think I borrowed some of the code from streamflow). Also I > >> have a service that when activated conditionally bootstraps some > >> initial data. My problem is that it is important that the re-indexer > >> service runs before the bootstrap service, but as I see it they are > >> not really dependent on each other, so making them dependent would be > >> weird I think. Maybe I'm attacking this from the wrong angle though. > >> Have any of you solved a similar problem in a different way? > > > > I do about the same two things in my app but "initial data" insertion > > happens only if it has not been inserted yet. I made it independent by > > querying for something that say "initial data inserted". YMMV. > > I think that´s what I´m doing too, if I´m not misunderstanding what you are > saying. But if the index is out of sync or has been removed for update and > the initial data insertion happens before reindexing, then these queries > may return nothing or the wrong data since they depend on a correct index. > > Right now I´m thinking that running these kind of operations on service > activations isn´t a good idea in the first place. Maybe such operations > should be done more explicitly?
You're right Ronnie, my bad. I faced the same issue you describe and in fact replaced the initial data insertion from a service activated on startup to code explicitly run only when the application is run the first time, ie. without relying on the service activation mechanism nor an index query. Paul _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

