[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ecf-dev] explicit discovery
- From: Scott Lewis <slewis@xxxxxxxxxxxxx>
- Date: Mon, 25 Jul 2016 09:58:22 -0700
- Delivered-to: email@example.com
- User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
On 7/25/2016 8:27 AM, Jonah Graham wrote:
Hi ECF folk,
I am trying to come up to speed with ECF for work on my project* and
evaluating its suitability. I am trying to have two Java (OSGi)
processes communicate simply. One of them hosts a simple OSGi service.
For now I am experimenting with the TimeService examples in the ECF
code. One of the key features of my consumer process is that it is a
short lived process that needs to interactive user realtime (i.e.
100ms to start JVM/OSGi, obtain service and call it).
My question is if the consumer already knows "where" the host service
is, how do I tell the consumer.
There's a xml file format called 'edef' (which stands for endpoint
description extender format) that can be used to describe an endpoint,
and to trigger discovery. This format is specified by the Remote
Service Admin specification.
So first is to create an edef file for your endpoint. There are
examples...e.g.  see timeserviceendpointdescription.xml. Also...FWIW,
ECF provides some utility classes to write endpoint descriptions
(automatically created during export) to the edef format (see
Once you have the edef you have OSGi trigger the discovery based upon it
in one of two ways:
1) By starting a bundle (like ) that has a Remote-Service header in
the manifest.mf (see manifest.mf in  for an example). Starting such a
bundle will trigger the import of the endpoint described in the
specified edef files.
2) By loading the edef, creating and EndpointDescription instance
(org.eclipse.ecf.osgi.remoteserviceadmin.EndpointDescription) and and
passing it to:
There is an OSGi standard RemoteServiceAdmin service (service
interface: org.osgi.service.remoteserviceadmin.RemoteServiceAdmin) that
you can get and use to make the above importService call. This is the
most controlled way to import a service as the thread that calls
importService will block until the import has occurred or it fails.
Creating an EndpointDescription to pass to importService is not
difficult. The easiest way within ECF is to use the
utility class to read an edef file. This is used for 1 above. Note
that once the edef is read, it's possible to get the properties,
manipulate them in the Map (e.g. check and or change the value of one or
more props) and then use the new properties to create a new
EndpointDescription before passing it to importService.
This needs more formal documentation, of course, but parts of things
(method 1) explained more here 
At the moment I am launching TimeServiceHost.generic.product and
TimeServiceConsumer.generic.product. As expected, there is a few
second delay on the consumer while it discovers the service. But if
the consumer knows the location of the host, I want to be able to
short circuit the time consuming discovery process.
I would be grateful to any pointers on where to start understanding
the discovery options and how to tailor them to my current use case.
There are other network-based discovery providers (slp, zeroconf, etcd,
zookeeper), and most of them do have ways to reduce the discovery delay,
but if not network communication at all is required then edef is
probably the way to go. For reference, here's some more docs on the
discovery providers themselves .
Please let me know if this helps.
* this project is different from the EASE + Py4J! Now that I am
getting familiar with ECF's use I am considering it for another
Kichwa Coders Ltd.
ecf-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit