Hello,
how does one define the affinity key in XML?
The documentation describes only the @CacheAffinityKeyMapped annotation.
I have found a couple of examples that define the affinity key in the
cacheKeyConfiguration. For example:
modules/yardstick/config/ignite-bin-multicast-config.xml
<bean id="grid.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration"
parent="base-ignite.cfg">
...
<property name="cacheKeyConfiguration">
<list>
<bean class="org.apache.ignite.cache.CacheKeyConfiguration">
<property name="typeName"
value="BinaryKeyWithLegacyIdentity"/>
<property name="affinityKeyFieldName" value="f3" />
</bean>
However, when I try to add cacheKeyConfiguration to my XML config file, I get
an exception:
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid
property 'cacheKeyConfiguration' of bean class
[org.apache.ignite.configuration.CacheConfiguration]: Bean property
'cacheKeyConfiguration' is not writable or has an invalid setter method. Does
the parameter type of the setter match the return type of the getter?
Also, looking at the configuration XSD (IgniteConfigurationSection.xsd),
affinityKeyFieldName seems to be allowed only in the binaryConfiguration.
I have two caches:
* Switches with a UUID as the key (representing switchId)
* PortStats with a POJO key (dateDate and PortId), and a switchId field in the
object POJO
I want to use switchId as the affinity key.
* For the Switch cache the affinity key is the same as the object's key. So, I
believe, no special config is required.
* For the PortStats cache, the affinity key is not part of the object's key,
but is a regular field in the object.
I don't know how to configure (in XML) the latter.
Thanks...
Roger