An opportunity has come up to include OSGi in a new project I'm involved in.
I'd like to hear some opinions, consideration to take into account and
perhaps some experiences with focus on how the reactive paradigm should fit
in a very dynamic OSGi ecosystem where services can come and go at any time.

With the code below as an example, my concerns are primarily with the
subscribe method where we are essentially passing it a listener,
'/doSomethingUseful/'; a no-no as per the *Whiteboard* pattern.
Another concern worth some thought is the /Subscription/ instance returned
from the same method which can become 'stale' at any time; the client can be
notified of this when /SomeService/ gets unbound but, how should
/SomeService/ handle the (multiple) subscription instances it could be
holding on to when it gets deactivated - cancel them? forcing the client
into a /subscription.isCancelled()/ logic.

I'm very interested to hear from you guys and thanks in advance...

class SomeServiceClient {

  @Reference
  private SomeService someService;

  private Subscription subscription;
  
  @Activate
  public void activate() {
    Parameters params = createParamStructure(config);
    // long living subscription?
    subscription = someService.subscribe(params, this::doSomethingUseful);
  }
  
  private void doSomethingUseful(MessageOfInterest msg) {
    // doing something interesting with msg
    // possibly called every second
  }
  
  @Deactivate
  public void deactivate() {
    subscription.cancel();
  }
}



--
View this message in context: 
http://apache-felix.18485.x6.nabble.com/OSGi-Reactive-Paradigm-tp5018956.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to