2016-04-29 22 views
0

我想獲得遠程OSGi服務與我現有的RCP應用程序(基於Mars)一起工作。然而,它似乎並沒有工作 - 我的應用程序的兩個實例沒有看到另一個發佈的服務。如何獲得遠程OSGi服務使用Eclipse ECF

我已將最新的ECF SDK添加到我的目標平臺,並且已將以下捆綁產品添加到我的產品運行時;

  • org.eclipse.ecf.discovery
  • org.eclipse.ecf.provider
  • org.eclipse.ecf.provider.remoteservice
  • org.eclipse.ecf.sharedobject
  • 組織。 eclipse.equinox.concurrent
  • org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy
  • org.eclipse.osgi.services.remoteserviceadmin
  • 個org.eclipse.ecf.remoteservice.asyncproxy
  • org.eclipse.ecf.remoteservice
  • org.eclipse.ecf.osgi.services.distribution
  • org.eclipse.ecf.provider.jmdns
  • CH .ethz.iks.r_osgi.remote
  • org.eclipse.ecf.provider.r_osgi
  • org.eclipse.ecf.console
  • org.eclipse.ecf.provider.dnssd
  • org.xbill.dns
  • org.eclipse.ecf.provider.discovery

在我的包激活的一個,我有以下的啓動方法()

ServiceTracker _containerManagerServiceTracker = new ServiceTracker(_context, IContainerManager.class.getName(), null); 
_containerManagerServiceTracker.open(); 

IContainerManager containerManager = (IContainerManager) _containerManagerServiceTracker.getService(); 

IContainer container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer"); 


IMyService myService = new MyService(); 
Properties props = new Properties(); 
props.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES, IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD); 
props.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS, "ecf.r_osgi.peer"); 
// register remote service 
context.registerService(IMyService.class, myService, props); 

我知道事登記我的服務正在作爲二審報告工作;

"WARNING: Port 9278 already in use. This instance of R-OSGi is running on port 9279" 

我還看到一個記錄在zeroconf瀏覽器中出現「_ECFOSGIRSVC」。

許多教程似乎表明,這項服務應該奇蹟般地在其他實例上可用。但是沒有出現任何內容(在應用程序控制臺中運行「服務」僅列出本地服務)。一些問題;

  • 這真的是需要的嗎?
  • 如何調試?
    • 我怎麼知道服務是否真的出口?
    • 如何知道其他實例是否真的在搜索它?
  • 是否可以a)報告出容器端點並「手動」連接另一個實例?

有很多「HelloService」教程的內容不盡相同,導致開始非常混亂!

回答

0

嘗試Riena Communication對於發佈和綁定遠程服務來說它較爲簡單。它使用hessian作爲通信協議。因爲它的基於二進制的協議(不是xml),所以它的速度真的很快,因爲它基於二進制協議(不是xml)

我希望這有助於。