[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] p2, dependency injection exploration

I have experimented with one part of this:

On Sep 10, 2009, at 4:08 PM, Pascal Rapicault wrote:

1) do I have one bus for my VM?
In this case, the initial pattern of grabbing THE bus and listening still works, though the events being broadcasted need to be more specific as some listeners would probably get things they don't care about.

I think it is best with one Bus per "p2 instance"

2) do I have one bus for each engine?
In this case, how are the listeners registered? How would a bundle interested in listening to a particular Engine know which bus to listen on? How could it come after the fact?

I implemented this by adding a context-id property when registering the event service. To consume a particular service, the context-id must be known, and the request is made by using a filter that includes the context-id property. Similar to p2, my use case has a default context instance expected to always be there, and there is a well known context-id defined for this. In my case, the context is itself a service, and I have one bundle that contains the set up of this default context.

Henrik Lindberg henrik.lindberg@xxxxxxxxxxxxxx