0

I'm trying to configure java gemfire template to query data in spring application.
To create spring template I need to create client-region, to create client-region I need to create client-cache, to create client-cache I need to create pool.
One of the pool parameters is server-goup. I need gemfire template(s) to query several of them.
I didn't find pool to be configurable for several server goups, thus I've created two pools (with different server goups) two client caches two client regions and two templates and got an error.

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.gemstone.gemfire.cache.GemFireCache] is defined: expected single bean but found

What I'm missing? How could I fix the error or manage to setup client region for several server groups?

Here is spring context:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:gfe="http://www.springframework.org/schema/gemfire"
    xmlns:util="http://www.springframework.org/schema/util" 
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
        http://www.springframework.org/schema/data/gemfire http://www.springframework.org/schema/data/gemfire/spring-data-gemfire.xsd">

    <gfe:pool id="mdfClientDataPool" subscription-enabled="true" server-group="clientData">
        <gfe:locator host="${gemfire.locator.primary.1}" port="${gemfire.locator.primary.port.1}" />
    </gfe:pool>
    <gfe:client-cache id="mdfClientDataCache" pool-name="mdfClientDataPool" properties-ref="gemfireProperties" />
    <gfe:client-region id="mdfClientDataRegion" cache-ref="mdfClientDataCache" />
    <bean id="mdfClientDataTemplate" class="org.springframework.data.gemfire.GemfireTemplate" p:region-ref="mdfClientDataRegion" />

    <gfe:pool id="mdfInstrumentDataPool" subscription-enabled="true" server-group="instrumentData">
        <gfe:locator host="${gemfire.locator.primary.1}" port="${gemfire.locator.primary.port.1}" />
    </gfe:pool>
    <gfe:client-cache id="mdfInstrumentCache" pool-name="mdfInstrumentDataPool" properties-ref="gemfireProperties" />
    <gfe:client-region id="mdfInstrumentRegion" cache-ref="mdfInstrumentCache" />
    <bean id="mdfInstrumentTemplate" class="org.springframework.data.gemfire.GemfireTemplate" p:region-ref="mdfInstrumentRegion" />

</beans>

Thanks.

Mike
  • 20,010
  • 25
  • 97
  • 140

1 Answers1

1

There is a server-group attribute on pool. You should be able to create multiple client regions each with its own pool and one client cache. There can only be one cache instance.

dturanski
  • 1,723
  • 1
  • 13
  • 8
  • trying to do this for few hours with no luck, do you have any examples or links on the net? – Mike Mar 13 '14 at 17:15
  • I'm not aware of any examples or tests of this but it's a valid use case. Could you paste your config? Or if you're reasonably confident you have configured what I described correctly, I would submit an issue to https://jira.spring.io/browse/SGF and post the configuration there. – dturanski Mar 13 '14 at 19:42
  • taking into consideration [Server Groups Overview](http://pubs.vmware.com/vfabric53/index.jsp?topic=/com.vmware.vfabric.sqlfire.1.1/data_management/ServerGroups.html) and [Assigning Tables to Server Groups](http://pubs.vmware.com/vfabric53/index.jsp?topic=/com.vmware.vfabric.sqlfire.1.1/data_management/server-groups-chapter.html) shouldn't I request server configuration for data to be available within single server group and then use single client pool with single server group, single client cache (using single pool) and multiply regions (using single client cache)? – Mike Mar 14 '14 at 08:49