How can the 'ecf.exported.containerfactoryargs' set dynamically while using DS? [message #716175] |
Tue, 16 August 2011 15:38  |
Marton Sigmond Messages: 73 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
Senior Software Engineer
|
|
|
|
Re: (no subject) [message #716849 is a reply to message #716459] |
Thu, 18 August 2011 15:19   |
Marton Sigmond Messages: 73 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
Senior Software Engineer
[Updated on: Thu, 18 August 2011 15:36] Report message to a moderator
|
|
|
|
Re: (no subject) [message #732303 is a reply to message #717753] |
Tue, 04 October 2011 13:17   |
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 #735240 is a reply to message #734753] |
Tue, 11 October 2011 10:06  |
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 10:06] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02326 seconds