Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Communications Framework (ECF) » How can the 'ecf.exported.containerfactoryargs' set dynamically while using DS?(<property name="ecf.exported.containerfactoryargs" type="String" value="r-osgi://1.2.3.4:9278"/>)
How can the 'ecf.exported.containerfactoryargs' set dynamically while using DS? [message #716175] Tue, 16 August 2011 11:38 Go to next message
Marton Sigmond is currently offline Marton Sigmond
Messages: 71
Registered: July 2009
Location: Hungary
Member
Hi,

what is the best practice to register a service declaratively while dynamically providing the IP address of the host computer?

I declared the following service:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="remote.service.provider">
   <implementation class="remote.service.provider.EchoService"/>
   <service>
      <provide interface="remote.service.IEchoService"/>
   </service>
   <property name="service.exported.interfaces" type="String" value="*"/>
   <property name="service.exported.configs" type="String" value="ecf.r_osgi.peer"/>
   <property name="ecf.exported.containerfactoryargs" type="String" value="r-osgi://1.2.3.4:9278"/>
</scr:component>

Then I could successfully consume it on a different PC using zookeeper.

However I would not be able to deploy the service onto another host computer, since the IP address is hard coded in it.

Could you please suggest how I could dynamically set the IP, while still using DS?

Thanks,
Marton


Best Regards,
Marton Sigmond
Software Design Engineer
(no subject) [message #716459 is a reply to message #716175] Wed, 17 August 2011 09:02 Go to previous messageGo to next message
Markus Kuppe is currently offline Markus Kuppe
Messages: 177
Registered: July 2009
Senior Member
On 08/16/2011 05:38 PM, Marton Sigmond wrote:
> Hi,
>
> what is the best practice to register a service declaratively while
> dynamically providing the IP address of the host computer?
>
> I declared the following service:
> <?xml version="1.0" encoding="UTF-8"?>
> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
> name="remote.service.provider">
> <implementation class="remote.service.provider.EchoService"/>
> <service>
> <provide interface="remote.service.IEchoService"/>
> </service>
> <property name="service.exported.interfaces" type="String" value="*"/>
> <property name="service.exported.configs" type="String"
> value="ecf.r_osgi.peer"/>
> <property name="ecf.exported.containerfactoryargs" type="String"
> value="r-osgi://1.2.3.4:9278"/>
> </scr:component>
>
> Then I could successfully consume it on a different PC using zookeeper.
>
> However I would not be able to deploy the service onto another host
> computer, since the IP address is hard coded in it.
>
> Could you please suggest how I could dynamically set the IP, while still
> using DS?
>
> Thanks,
> Marton

Hi Marton,

you might be confusing terms here. "Zookeeper" is a discovery mechanism
(like e.g. JmDNS, SLP or DNS-SD) especially designed to dynamically
discovery services and to get rid of hard coded IPs/hostnames. It does
not deal with how the service is eventually consumed remotely. This is
in ECF land left to the generic or r-OSGi provider (among others).

In order to remove the provider specific properties from the DS file,
you deploy one of the aforementioned discovery protocols and have it
advertise the service.

What does your network environment look like? Choosing a discovery
pretty much depends on it.

Markus
Re: (no subject) [message #716849 is a reply to message #716459] Thu, 18 August 2011 11:19 Go to previous messageGo to next message
Marton Sigmond is currently offline Marton Sigmond
Messages: 71
Registered: July 2009
Location: Hungary
Member
Thank you for your reply, Markus!

I started to experiment remote services based on the following site:
http://wiki.eclipse.org/EIG:Getting_Started_with_OSGi_Remote_Services
I thought that advertising a service needs the "ecf.exported.containerfactoryargs" property to be set (and all examples had an IP in it).

How could I setup Zookeeper so, that I could get rid of the hard coded IP address from the component definition?

The goal is to create a failure-proof, load balanced system with 2-4 hosts on LAN.
Services shall be advertised as deployed.

Would you recommend something else then Zookeeper for this task?

Thanks,
Marton


Best Regards,
Marton Sigmond
Software Design Engineer

[Updated on: Thu, 18 August 2011 11:36]

Report message to a moderator

Re: (no subject) [message #717753 is a reply to message #716849] Mon, 22 August 2011 04:50 Go to previous messageGo to next message
Marton Sigmond is currently offline Marton Sigmond
Messages: 71
Registered: July 2009
Location: Hungary
Member
It works if I don't set the "ecf.exported.containerfactoryargs" property.

Cheers,
Marton


Best Regards,
Marton Sigmond
Software Design Engineer
Re: (no subject) [message #732303 is a reply to message #717753] Tue, 04 October 2011 09:17 Go to previous messageGo to next message
Stefano Ghio is currently offline Stefano Ghio
Messages: 12
Registered: September 2011
Junior Member
Greetings,

not setting the ecf.exported.containerfactoryargs property and using Zookeeper results in the service being published under the machine's name instead of its IP.

I see:
ZooDiscovery> Service Published: 4-ott-2011 15.11.37. ServiceInfo[uri=ecf.osgirsvc://stefghiow:2794/osgirsvc_JgIBi/vAgO9XkT01C4CmbjAFc/c=;id=ServiceID[type=ServiceTypeID[typeName=_ecf.osgirsvc._default.default._iana];location=ecf.osgirsvc://stefghiow:2794/osgirsvc_JgIBi/vAgO9XkT01C4CmbjAFc/c=;full=_ecf.osgirsvc._default.default._iana@ecf.osgirsvc://stefghiow:2794/osgirsvc_JgIBi/vAgO9XkT01C4CmbjAFc/c=];priority=0;weight=0;props=ServiceProperties[{endpoint.service.id=1, component.name=it.eng.test.remote.ds.helloservice, objectClass=it.eng.test.remote.ds.hello.IHello, endpoint.framework.uuid=d0955d63-8aee-0010-1e9d-bc502ee85ecd, remote.intents.supported=passByValue exactlyOnce ordered, ecf.endpoint.id.ns=org.eclipse.ecf.core.identity.StringID, remote.configs.supported=ecf.generic.server, endpoint.id=ecftcp://stefghiow:2794/server, component.id=0, service.imported.configs=ecf.generic.server}]]


While if I set that property as:
<property name="ecf.exported.containerfactoryargs" type="String" value="ecftcp://192.168.23.28:6666/hello"/>

I see:
ZooDiscovery> Service Published: 4-ott-2011 15.13.26. ServiceInfo[uri=ecf.osgirsvc://192.168.23.28:6666/osgirsvc_Tz1f2EzTCQo7EjICfaKZ8qSC7JI=;id=ServiceID[type=ServiceTypeID[typeName=_ecf.osgirsvc._default.default._iana];location=ecf.osgirsvc://192.168.23.28:6666/osgirsvc_Tz1f2EzTCQo7EjICfaKZ8qSC7JI=;full=_ecf.osgirsvc._default.default._iana@ecf.osgirsvc://192.168.23.28:6666/osgirsvc_Tz1f2EzTCQo7EjICfaKZ8qSC7JI=];priority=0;weight=0;props=ServiceProperties[{endpoint.service.id=1, component.name=it.eng.test.remote.ds.helloservice, objectClass=it.eng.test.remote.ds.hello.IHello, endpoint.framework.uuid=a0b036a4-8aee-0010-12c9-f96c32002514, remote.intents.supported=passByValue exactlyOnce ordered, ecf.endpoint.id.ns=org.eclipse.ecf.core.identity.StringID, remote.configs.supported=ecf.generic.server, endpoint.id=ecftcp://192.168.23.28:6666/hello, component.id=0, service.imported.configs=ecf.generic.server}]]


The only difference is that IP:PORT which I hardcoded is used instead of HOSTNAME:RANDOM_PORT. The problem is, other hosts are not able to resolve the HOSTNAME, I would have to configure them all to resolve it to the right IP.

How can Zookeeper be set to use the machine's IP instead of the hostname when publishing services without that property set?

Thank you,

regards
Re: (no subject) [message #734753 is a reply to message #732303] Sun, 09 October 2011 15:23 Go to previous messageGo to next message
Wim Jongman is currently offline Wim Jongman
Messages: 275
Registered: July 2009
Senior Member

Hi Stefano,

This is solved here [1] correct?

[1] http://www.eclipse.org/forums/index.php/t/243843/

Regards,

Wim
Re: (no subject) [message #735240 is a reply to message #734753] Tue, 11 October 2011 06:06 Go to previous message
Stefano Ghio is currently offline Stefano Ghio
Messages: 12
Registered: September 2011
Junior Member
Greetings,

not quite, that thread was about how to configure replicated and centralized zookeeper modes but the problem depicted here still applies.

I'm asking how to make Zookeeper broadcast the host's IP instead of its hostname when the property ecf.exported.containerfactoryargs is not set.

This is a problem since it would require every other host to be able to correctly resolve the hostnames.

For example, if the property is set Zookeeper broadcasts this information:
endpoint.id=ecftcp://192.168.23.28:6666/hello


otherwise it will say:
endpoint.id=ecftcp://stefghiow:2794/server


In the latter, other machines are not able to resolve stefghiow to the right IP unless they rely on a router or hosts file, which I don't want to.

Thanks,

have a nice day, or night, wherever you are

[Updated on: Tue, 11 October 2011 06:06]

Report message to a moderator

Previous Topic:problem getting the examples running on Max OSX Server Lion
Next Topic:Problem running ECF 3.5.2 on Helios
Goto Forum:
  


Current Time: Thu Jul 24 20:38:10 EDT 2014

Powered by FUDForum. Page generated in 0.01736 seconds