Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Communications Framework (ECF) » How to publish remote services (r-osgi) automatically / discover peers ?
How to publish remote services (r-osgi) automatically / discover peers ? [message #624037] Mon, 08 September 2008 13:01 Go to next message
Florian Georg is currently offline Florian Georg
Messages: 34
Registered: July 2009
Member
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 #624038 is a reply to message #624037] Mon, 08 September 2008 21:23 Go to previous messageGo to next message
Scott Lewis is currently offline Scott Lewis
Messages: 971
Registered: July 2009
Senior Member
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.

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.

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 #624039 is a reply to message #624038] Tue, 09 September 2008 19:55 Go to previous messageGo to next message
Florian Georg is currently offline Florian Georg
Messages: 34
Registered: July 2009
Member
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 05:05 Go to previous messageGo to next message
Scott Lewis is currently offline Scott Lewis
Messages: 971
Registered: July 2009
Senior Member
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 14:52 Go to previous message
Florian Georg is currently offline Florian Georg
Messages: 27
Registered: July 2009
Junior Member
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
Previous Topic:Getting the running r-OSGi port number before registering a service
Next Topic:Problems running ECF2.0.0 remote service examples
Goto Forum:
  


Current Time: Sat Oct 25 13:31:47 GMT 2014

Powered by FUDForum. Page generated in 0.02079 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software