Hello, I'm trying to implement a remote OSGI service. I'm using spring DM to export service and to import service. Exported service and service consumer are running in to different Karaf container. There is two container which export the remote service. When i'm start Karaf container exporting the services, Service Reference is correctly reference in ZooKeeper and then correctly register by the Remote Service Admin :
Bundle-SymbolicName = vault-service-endpoint-dosgi Bundle-Version = 0.0.1 endpoint.framework.uuid = a6b6f785-0372-4edc-8998-85b15d73031c endpoint.id = http://localhost:9002/sts/vault endpoint.package.version.com.sts.confiance.vault.endpoint.dosgi = 0.0.0 endpoint.service.id = 196 objectClass = com.sts.confiance.vault.endpoint.dosgi.VaultServiceDosgi org.apache.cxf.ws.address = http://localhost:9002/sts/vault org.springframework.osgi.bean.name = vaultServiceDosgiBean service.id = 224 service.imported = true service.imported.configs = org.apache.cxf.ws service.intents = SOAP.1_1, HTTP, SOAP But, when i'm stopping one container exporting the service, the reference is correctly removed from ZooKeeper, but reference is not unregister from the Remote Service Admin and an exception is throw when consumer try to call the remote service. What i want is automatically switch on the other container. Next step will be to add a Round Robin mode. Could you help me. Thanks, Jérôme ============================ Exporting services <osgi:service id="vaultServiceDosgi" ref="vaultServiceDosgiBean" interface="com.sts.confiance.vault.endpoint.dosgi.VaultServiceDosgi"> <osgi:service-properties> <entry key="service.exported.interfaces" value="*" /> <entry key="org.apache.cxf.ws.address" value=" http://localhost:9002/sts/vault" /> </osgi:service-properties> </osgi:service> <bean id="vaultServiceDosgiBean" class="com.sts.confiance.vault.endpoint.dosgi.impl.VaultServiceDosgiImpl"> ============================= Importing services <osgi:reference id="vaultServiceRef" interface="com.sts.confiance.vault.endpoint.dosgi.VaultServiceDosgi"/> <bean class="com.sts.confiance.test.VaultServiceConsumer" init-method="start" destroy-method="stop"> <property name="vaultService" ref="vaultServiceRef"/> </bean> ============================= Service consumer public class VaultServiceConsumer { private static final Logger logger = LoggerFactory.getLogger(VaultServiceConsumer.class); private VaultServiceDosgi vaultService; private VaultServiceConsumerThread vaultServiceConsumerThread; public void setVaultService(VaultServiceDosgi vaultService) { this.vaultService = vaultService; } public void start() { logger.info("Start the vault service consumer"); vaultServiceConsumerThread = new VaultServiceConsumerThread(vaultService); vaultServiceConsumerThread.start(); <==== this thread only call vaultService method every 5 seconds } public void stop() { vaultServiceConsumerThread.exit(); } } ============================= Thanks, Jérôme
