[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] explicit discovery


The EndpointDescription sounds like exactly what I need. I will
experiment with that to understand better.

Jonah Graham
Kichwa Coders Ltd.

On 25 July 2016 at 17:58, Scott Lewis <slewis@xxxxxxxxxxxxx> wrote:
> Hi Jonah,
> 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. [1] see timeserviceendpointdescription.xml. Also...FWIW, ECF
> provides some utility classes to write endpoint descriptions (automatically
> created during export) to the edef format (see
> org.eclipse.ecf.osgi.remoteserviceadmin.EndpointDescriptionWriter).
> 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 [1]) that has a Remote-Service header in the
> manifest.mf (see manifest.mf in [1] 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:
> RemoteServiceAdmin.importService(EndpointDescription)
> 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
> org.eclipse.ecf.osgi.remoteserviceadmin.EndpointDescriptionReader 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 [2]
>> 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.
> Yes.
>> 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 [3].
> Please let me know if this helps.
> Scott
> [1]
> http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/examples/bundles/com.mycorp.examples.timeservice.consumer.filediscovery
> [2]
> http://wiki.eclipse.org/EIG:File-based_Discovery_with_the_Endpoint_Description_Extender_Format
> [3] http://wiki.eclipse.org/Discovery_Providers
>> Thanks,
>> Jonah
>> * this project is different from the EASE + Py4J! Now that I am
>> getting familiar with ECF's use I am considering it for another
>> project.
>> ~~~
>> Jonah Graham
>> Kichwa Coders Ltd.
>> www.kichwacoders.com
>> _______________________________________________
>> ecf-dev mailing list
>> ecf-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/ecf-dev
> _______________________________________________
> ecf-dev mailing list
> ecf-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/ecf-dev