Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Is ECF Discovery Service necessary when using RemoteServices

On 01/14/2011 02:21 PM, Bartosz Czerwiński wrote:
>> On Behalf Of Markus Alexander Kuppe
>> Sent: Friday, January 14, 2011 2:05 PM
>>
>> On 01/14/2011 01:32 PM, Bartosz Czerwiński wrote:
>>
>>> Let's say that the location of the service (protocol, IP address and port) is
>> fixed. I registered service on the host side and tried to access it on the
>> consumer side using ServiceTracker. Unfortunately it does not work. I'm not
>> sure what I did wrong.
>>
>> What does your ServiceTracker look like?
> Host side:
> Properties props = new Properties();
> 		props.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES,
> 				IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD);
> 		props.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS,
> 				CONTAINER_TYPE);
> 		props.put(
> 				IDistributionConstants.SERVICE_EXPORTED_CONTAINER_FACTORY_ARGUMENTS,
> 				CONTAINER_ID);
> 		serviceRegistration = bundleContext.registerService(
> 				IStockService.class.getName(), new GpwStockService(), props);
> 
> Consumer side:
> stockServiceTracker = new ServiceTracker(bundleContext,
> 				bundleContext.createFilter("(&("
> 						+ org.osgi.framework.Constants.OBJECTCLASS + "="
> 						+ IStockService.class.getName() + ")("
> 						+ IDistributionConstants.SERVICE_IMPORTED + "=*))"),
> 				this);
> 		stockServiceTracker.open();
> 

How is the consumer side with this tracker supposed to know the
location/address of the host? %)

If you want your consumers to magically get access to remote service
references, use ECF discovery and a discovery provider that works with
your network topology.

Markus


Back to the top