How to publish remote services (r-osgi) automatically / discover peers ? [message #624037] |
Mon, 08 September 2008 09:01  |
Eclipse User |
|
|
|
Hi,
I have some "local" OSGi/Equinox application, making heavy use of
declarative services.
I now want ECF to "publish" (and consume) my services (possibly
filtered) automatically and transparent as R-OSGI remote services.
What I currently do is:
1. Track my services
2. Use the ServiceReference to get the actual service
3. Iterate over the serviceObject.getClass().getInterfaces() and
register the object for each of the implemented interfaces on the
RemoteServiceContainerAdapter
Is there a another/cleaner/better/smarter way of doing this?
Ideally, I would like all services to be published for remote access
based on some metadata ("publish.remote=true") automatically.
Service Trackers / Decarative Services should find both local services
and proxies to remote services transparently - and be able to decide
which one to use.
How can I then discover the available remote r-OSGI server instances in
my network and connect to them? Not sure I understand the discovery
mechanism completly....
thanks for any pointers / snippets.
cheers,
Florian
|
|
|
|
Re: How to publish remote services (r-osgi) automatically / discover peers ? [message #624039 is a reply to message #624038] |
Tue, 09 September 2008 15:55   |
Eclipse User |
|
|
|
Hi Scott, thanks for the answers, pls see below
Scott Lewis wrote:
> Hi Florian,
>
> We have a remote service property AUTOREGISTER_REMOTE_PROXY [1] that can
> be used to automatically register proxies in the local service registry.
> This property is specified when the IRemoteService is registered. Here
> [2] is some test/example code that does this.
Basically, I would like it the other way around .... services are
already locally instantiated/registered with declarative services
- I want to publish them additionally as remote services.
Currently I use a ServiceTracker to track my services and
register/unregister them on the RemoteServiceContainerAdapter... I
suppose there's no other "ECF standard" way of doing so, or is there?
> In our own tests (i.e. with the generic provider and xmpp provider) this
> allows either ServiceReference-based or ServiceTracker-based lookup of
> the proxy to succeed...e.g. test code in [3]. Frankly I haven't tried
> declarative services-based lookup, but it seems to me it should work as
> well.
> Please let me know if you would like more/other information...or
> encounter difficulties.
BTW: why is the JSLP discovery provider not started automatically like
the jmdns one? I managed to switch to the JSLP version but had big
performance issues during connect and service registration (timeouts),
so I went back to jmdns...
kind regards,
Florian
> Scott
>
> [1]
> http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/ecli pse/ecf/remoteservice/Constants.html
>
> [2]
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tes ts/org.eclipse.ecf.tests.remoteservice/src/org/eclipse/ecf/t ests/remoteservice/generic/TransparentProxyTest.java?root=Te chnology_Project&view=markup
>
> [3]
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tes ts/org.eclipse.ecf.tests.remoteservice/src/org/eclipse/ecf/t ests/remoteservice/generic/ServiceTrackerTest.java?root=Tech nology_Project&view=markup
>
>
>
>
> Florian Georg wrote:
>> Hi,
>>
>> I have some "local" OSGi/Equinox application, making heavy use of
>> declarative services.
>>
>> I now want ECF to "publish" (and consume) my services (possibly
>> filtered) automatically and transparent as R-OSGI remote services.
>>
>> What I currently do is:
>> 1. Track my services
>> 2. Use the ServiceReference to get the actual service
>> 3. Iterate over the serviceObject.getClass().getInterfaces() and
>> register the object for each of the implemented interfaces on the
>> RemoteServiceContainerAdapter
>>
>>
>> Is there a another/cleaner/better/smarter way of doing this?
>>
>> Ideally, I would like all services to be published for remote access
>> based on some metadata ("publish.remote=true") automatically.
>>
>> Service Trackers / Decarative Services should find both local services
>> and proxies to remote services transparently - and be able to decide
>> which one to use.
>>
>> How can I then discover the available remote r-OSGI server instances
>> in my network and connect to them? Not sure I understand the discovery
>> mechanism completly....
>>
>>
>>
>> thanks for any pointers / snippets.
>> cheers,
>> Florian
|
|
|
Re: How to publish remote services (r-osgi) automatically / discover peers ? [message #624040 is a reply to message #624039] |
Wed, 10 September 2008 01:05   |
Eclipse User |
|
|
|
Hi Florian,
Florian Georg wrote:
> Hi Scott, thanks for the answers, pls see below
>
> Scott Lewis wrote:
>> Hi Florian,
>>
>> We have a remote service property AUTOREGISTER_REMOTE_PROXY [1] that
>> can be used to automatically register proxies in the local service
>> registry. This property is specified when the IRemoteService is
>> registered. Here [2] is some test/example code that does this.
> Basically, I would like it the other way around .... services are
> already locally instantiated/registered with declarative services
> - I want to publish them additionally as remote services.
> Currently I use a ServiceTracker to track my services and
> register/unregister them on the RemoteServiceContainerAdapter... I
> suppose there's no other "ECF standard" way of doing so, or is there?
Hmmm...no that's the 'standard' way...i.e. register them on the
RemoteServiceContainerAdapter.
It might make a nice utility class to use your ServiceTrackerCustomizer
so that it detected local registrations for a given interface (which is
I assume what you do), and then made them remote by registering them
with RemoteServiceContainerAdapter.registerRemoteService. Would you
consider contributing your code for doing this?
>
>> In our own tests (i.e. with the generic provider and xmpp provider)
>> this allows either ServiceReference-based or ServiceTracker-based
>> lookup of the proxy to succeed...e.g. test code in [3]. Frankly I
>> haven't tried declarative services-based lookup, but it seems to me it
>> should work as well.
>> Please let me know if you would like more/other information...or
>> encounter difficulties.
>
> BTW: why is the JSLP discovery provider not started automatically like
> the jmdns one? I managed to switch to the JSLP version but had big
> performance issues during connect and service registration (timeouts),
> so I went back to jmdns...
I'll have to refer you to Markus and Jan for more details about JSLP.
We're in the middle of some bug fixes there (e.g.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=238710). So I'll have to
defer to them about the startup sequence for jslp.
Scott
|
|
|
Re: How to publish remote services (r-osgi) automatically / discover peers ? [message #624062 is a reply to message #624040] |
Thu, 11 September 2008 10:52  |
Eclipse User |
|
|
|
Hi Scott,
thanks for your support... sure I'm willing to contribute - I will open
a bugzilla entry and attach my utility class if that's fine with you.
(as soon as I have done a bit refactoring/polish - I'm still a bit new
to ECF...)
regards,
Florian
Scott Lewis schrieb:
> Hi Florian,
>
> Florian Georg wrote:
>> Hi Scott, thanks for the answers, pls see below
>>
>> Scott Lewis wrote:
>>> Hi Florian,
>>>
>>> We have a remote service property AUTOREGISTER_REMOTE_PROXY [1] that
>>> can be used to automatically register proxies in the local service
>>> registry. This property is specified when the IRemoteService is
>>> registered. Here [2] is some test/example code that does this.
>> Basically, I would like it the other way around .... services are
>> already locally instantiated/registered with declarative services
>> - I want to publish them additionally as remote services.
>> Currently I use a ServiceTracker to track my services and
>> register/unregister them on the RemoteServiceContainerAdapter... I
>> suppose there's no other "ECF standard" way of doing so, or is there?
>
> Hmmm...no that's the 'standard' way...i.e. register them on the
> RemoteServiceContainerAdapter.
>
> It might make a nice utility class to use your ServiceTrackerCustomizer
> so that it detected local registrations for a given interface (which is
> I assume what you do), and then made them remote by registering them
> with RemoteServiceContainerAdapter.registerRemoteService. Would you
> consider contributing your code for doing this?
>
>>
>>> In our own tests (i.e. with the generic provider and xmpp provider)
>>> this allows either ServiceReference-based or ServiceTracker-based
>>> lookup of the proxy to succeed...e.g. test code in [3]. Frankly I
>>> haven't tried declarative services-based lookup, but it seems to me
>>> it should work as well.
>>> Please let me know if you would like more/other information...or
>>> encounter difficulties.
>>
>> BTW: why is the JSLP discovery provider not started automatically like
>> the jmdns one? I managed to switch to the JSLP version but had big
>> performance issues during connect and service registration (timeouts),
>> so I went back to jmdns...
>
> I'll have to refer you to Markus and Jan for more details about JSLP.
> We're in the middle of some bug fixes there (e.g.
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=238710). So I'll have to
> defer to them about the startup sequence for jslp.
>
> Scott
|
|
|
Powered by
FUDForum. Page generated in 0.27590 seconds