-
1. Re: osgi service without restart of projects referencing it
ffang Mar 8, 2012 7:11 PM (in response to jjakub)Hi,
I don't think so.
And why you need it?
If the service exposing bundle restart, it means the old service it exposed is gone so if the service reference bundle not restart/refresh at the same time, it will cause the service reference bundle doesn't work correctly as it still hold the invalid service reference.
However, I think you can just update the service exposing bundle, this by default will not cause any bundle refresh/restart.
Freeman
-
2. Re: osgi service without restart of projects referencing it
jjakub Mar 9, 2012 3:45 AM (in response to ffang)We want to get rid of nmr, to be able to use camel standalone without servicemix, as far as I know nmr cannot be used without servicemix. If direct: would work across bundles It would be the best, but direct: doesn't work across bundles.
I want to be able to communicate across bundles. Now we use nmr to communicate across bundles. We replace nmr with osgi service exposed by the target bundle:
private Map<String, String> routeMap;
@Produce
protected ProducerTemplate producer;
private CamelContext camelContext;
@Override
public void setCamelContext(CamelContext camelContext) {
this.camelContext = camelContext;
}
@Override
public CamelContext getCamelContext() {
return camelContext;
}
@Override
public void process(Exchange exchange) throws Exception {
String serviceQName = extractServiceQName(exchange);
String uri = routeMap.get(serviceQName);
CamelContext callerContext = exchange.getContext();
setExchangeContext(exchange, camelContext);
producer.send(uri, exchange);
setExchangeContext(exchange, callerContext);
}
possibly cardinality="0..1"-> http://static.springsource.org/osgi/docs/1.2.1/reference/html/service-registry.html#service-registry:refs:singular:cardinality will solve my problem
-
3. Re: osgi service without restart of projects referencing it
davsclaus Mar 9, 2012 5:28 AM (in response to jjakub)People have been using the Camel VM component to communicate across bundles. But note that the VM component was originally not designed for OSGi communication.
OSGi bundles can also communicate directly using OSGi services, so you can export a bean into the OSGi service registry, and then reference that bean from another bundle, and then use that bean.
Then you can use the in Camel routes to access this bean, and communicate between bundles.
-
4. Re: osgi service without restart of projects referencing it
jjakub Mar 13, 2012 12:34 PM (in response to jjakub)cardinality="0..1" was what I needed
Thans All for help,