从OSGi容器外部查找OSGi服务 [英] Looking up OSGi services from outside the OSGi container

查看:162
本文介绍了从OSGi容器外部查找OSGi服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Karaf中部署了一组捆绑软件,并公开了许多OSGi服务,我希望这些OSGi服务可以从(可能)在另一台计算机上运行并且在非OSGi容器中运行的应用程序进行远程查找和调用. .虽然我最初是使用JNDI查找来获取我想要的服务,但是我从

I have a set of bundles deployed in Karaf and exposing a number of OSGi services which I would like to be able to lookup and call remotely, from an application running on a (possibly) different machine and in a non-OSGi container. My initial though was to use JNDI lookup to get the services I want however I understand from an earlier stackoverflow post that this might not be supported (I say might since I haven't been able to find any information on whether anything has changed on the Aries JNDI implementation in the past year). In that case I guess my other options would be to use CXF to expose a JAX-WS or JAX-RS API for my services.

我对情况的理解正确吗?在我的情况下,JNDI查找真的不是一种选择吗?还有其他我没想到的选择吗?

Is my understanding of the situation correct? Is JNDI lookup really not an option in my case? Are there any other alternatives I have not thought of?

推荐答案

简单的jndi查找将不起作用. OSGi服务本身不适合远程处理.因此,即使可以某种方式获得jndi对象,也无法调用它.

A simple jndi lookup will not work. OSGi services are not suitable for remoting per se. So even if you can get the jndi object in some way you can not call it.

可能的解决方案是手动cxf代理和终结点,如您已经发现的和Distributed OSGi.请参阅CXF-DOSGi和Eclipse ECF.两者都可以提供从一个OSGi框架到另一个OSGi框架的透明服务调用.如果您还在客户端使用OSGi,则DOSGi是理想的选择. 至少在CXF DOSGi的情况下,也可以在服务器端使用DOSGi,在客户端使用普通的CXF客户端.因此,您可以最大程度地减少服务器端的工作量.

Possible solutions are manual cxf proxies and endpoints like you already found and Distributed OSGi. See CXF-DOSGi and Eclipse ECF. Both can offer transaparent service calls from one OSGi framework to another. DOSGi is ideal if you also use OSGi on the client side. At least in case of CXF DOSGi it is also possible to use DOSGi on the server side and a normal CXF client on the client side. So you can keep the effort on the server side minimal.

另请参见 CXF DOSGi教程

这篇关于从OSGi容器外部查找OSGi服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆