tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Nash <n...@apache.org>
Subject Re: [1.5.1] Domain manager and binding.sca
Date Mon, 03 Aug 2009 11:58:22 GMT
Simon Nash wrote:
> Simon Laws wrote:
>> Hi Simon
>>>> When creating a domain configuration from scratch using the
>>>> Domain Manager GUI, the generated configuration files don't include
>>>> a <binding.sca> entry.  This means that deployed composites that
>>>> use binding.sca for inter-node communication don't work "out of the
>>>> box" in a distributed domain configuration.  In order to get this
>>>> to work, it's necessary to manually edit the generated domain
>>>> configuration to add <binding.sca> elements to the node definitions.
>> snip...
>> Can you give a specific example here. I don't quite understand what
>> you mean. I just ran up the store tutorial where for an input of...
>>     <component name="StoreCatalog">
>>         <implementation.java class="services.FruitsCatalogImpl"/>
>>         <property name="currencyCode">USD</property>
>>         <service name="Catalog">
>>             <t:binding.jsonrpc/>
>>            </service>
>>         <reference name="currencyConverter" 
>> target="StoreCurrencyConverter"/>   
>>     </component>
>>     <component name="StoreCurrencyConverter">
>>         <implementation.java class="services.CurrencyConverterImpl"/>
>>     </component>
>> I get an output from the domain manager of...
>> <component name="StoreCatalog" uri="StoreCatalog">
>>   <implementation.java class="services.FruitsCatalogImpl"/>
>>   <service name="Catalog">
>>     <interface.java interface="services.Catalog"/>
>>     <ns2:binding.jsonrpc name="Catalog"
>> uri="http://localhost:8100/StoreCatalog"/>
>>     <callback/>
>>   </service>
>>   <reference name="currencyConverter">
>>     <interface.java interface="services.CurrencyConverter"/>
>>     <binding.sca
>> name="currencyConverter#StoreCurrencyConverter/CurrencyConverter"
>> uri="/StoreCurrencyConverter"/>
>>     <callback/>
>>   </reference>
>>   <property name="currencyCode" mustSupply="false" many="false"
>> type="ns2:string">USD</property>
>> </component>
>> <component name="StoreCurrencyConverter" uri="StoreCurrencyConverter">
>>   <implementation.java class="services.CurrencyConverterImpl"/>
>>   <service name="CurrencyConverter">
>>     <interface.java interface="services.CurrencyConverter"/>
>>     <binding.sca name="CurrencyConverter" uri="/StoreCurrencyConverter"/>
>>     <callback/>
>>   </service>
>> </component>
>> Are you talking about forward calls or callbacks or both?
>> Regards
>> Simon
> Sorry that my previous note was not clear.  I was referring to the files
> in the "cloud" directory that are generated by the Domain Manager GUI
> when using the Domain Manager GUI with no predefined configuration.
> These currently have host/port entries for binding.ws, binding.http,
> binding.jsonrpc, and binding.atom.  They don't include a host/port entry
> for binding.sca.
> Without this entry, application composites will always have local-only
> <binding.sca> entries (as your example shows) which means they can't
> use binding.sca to communicate between different nodes.  This applies
> to both forward calls and callbacks.
> The good news is that my builder fix to optimize intra-node binding.sca
> calls (option 3 from my earlier post) is now working for forward calls.
> I now need to enable callback support, which shouldn't take long.
> After that I'll run a full build to make sure that my changes haven't
> disturbed anything.
It looks like my fix is working OK.  It solves the "catch 22" of the
binding URIs being created before the wiring is done.  This ordering means
that it isn't possible to use the presence or absence of wires to influence
whether a relative or absolute URI is created for binding.sca.

The desired behaviour for <binding.sca> is to create an absolute URI for
reference and service bindings (including reference callback bindings) if
the reference and service are wired across composites running on different
nodes in a distributed configuration.  For references and services that
aren't wired, or that are wired within a composite running on a single node
in a distributed configuration, the binding URI should be relative so that
locally optimized calling is used.

With my fix, the URI creation step still happens first.  If the binding
type is binding.sca and the builders are being called by the domain manager
to create a node configuration, a "tentative" relative URI is created for
the binding and the binding is added to a Map that maintains binding/node
relationships (the bindingMap).

When the domain wiring is done later, there is code in the matchBinding()
method of BindingConfigurationUtil that uses the bindingMap created in the
first step to look up which node the reference or service is running on.
If the source and target of the wire are running on different nodes, the
"tentative" relative URI is updated to convert it to an absolute URI with
host/port information.  In all other cases the "tentative" relative URI
is left unchanged.

For reference callback URIs, the "tentative" relative URI is updated to an
absolute URI if and only if the target of the forward wire is outside the
current node.

If the builders are not being called by the domain manager, the bindingMap
will be null and none of the above processing will happen.

I have created TUSCANY-3193 to track this issue and I would like to commit
the fix described above to the 1.5.1 branch unless there are any concerns or
objections.  I have done a full build with this fix and everything seems OK.


View raw message