Announcement Announcement Module
Collapse
No announcement yet.
gfe:locator is ignored for gfe:client-cache in Spring GemFire namespace Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • gfe:locator is ignored for gfe:client-cache in Spring GemFire namespace

    I do suspect this is a bug, but it's always better to double-check first, so here goes...

    I'm using Spring GemFire version 1.1.1.RELEASE, together with the GemFire v.6.6.2. The cache server is running locally in a different VM from the test program, using a locator listening to localhost:55221 (using
    Code:
    cacheserver start start-locator=localhost[55221]
    The client uses the following Spring XML to connect to the server:

    test.xml:
    Code:
    <?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"
    	xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    		http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
    		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
    	<util:map id="cacheProperties" map-class="java.util.Properties">
    		<entry key="log-level" value="config" />
    	</util:map>
    	<gfe:pool>
    		<gfe:locator host="localhost" port="55221" />
    	</gfe:pool>
    	<gfe:client-cache properties-ref="cacheProperties" />
    </beans>
    The only reason for the properties is to see the log messages during cache initialization.

    When the client code instantiates this Spring context, using nothing else but
    Code:
    	public static void main(String[] args) throws Exception {
    		new GenericXmlApplicationContext("classpath:test.xml");
    	}
    I see the following lines in the log (emphasis mine):

    [info 2012/04/25 10:28:29.210 EDT <main> tid=0x1] Running in local mode since mcast-port was 0 and locators was empty.

    [info 2012/04/25 10:28:29.273 EDT <Thread-1 StatSampler> tid=0xc] Disabling statistic archival.

    [config 2012/04/25 10:28:29.444 EDT <main> tid=0x1] Pool DEFAULT started with multiuser-authentication=false

    [config 2012/04/25 10:28:29.444 EDT <poolTimer-DEFAULT-2> tid=0x11] Updating membership port. Port changed from 0 to 50,458.

    [config 2012/04/25 10:28:29.445 EDT <main> tid=0x1] Pool gemfire-pool started with multiuser-authentication=false

    I checked the operation of several cache clients running in different threads, and they do indeed run in local modes - no changes get propagated anywhere.

    Am I, um, doing something wrong? The intention was to connect to the cache server using specified locator, yet the locator is clearly ignored...

  • #2
    Hi Alex,

    - How do you know changes to the cache are not being propagated to the members?
    - Where and how are you configuring the region(s)?

    I have almost the exact same setup and I DO see the same Running in local mode since mcast-port was 0 and locators was empty message but the client seems to be connecting through the dedicated pool and changes being propagated to the cache server nodes.

    Server console shows this:

    Code:
    [info 2012/05/02 12:02:51.784 CDT Spring GemFire Cache <ServerConnection on port 40404 Thread 1> tid=0x35] 
    ClientHealthMonitor: Registering client with member id identity(70.125.155.138(:loner):57473:4e1b810e:Spring 
    GemFire Cache,connection=1
    
    [info 2012/05/02 12:02:51.819 CDT Spring GemFire Cache <Handshaker /0:0:0:0:0:0:0:0:40404 Thread 1> tid=0x34] 
    Initializing region _gfe_non_durable_client_with_id_70.125.155.138(:loner):57473:4e1b810e:Spring GemFire 
    Cache_1_queue
    
    [info 2012/05/02 12:02:51.861 CDT Spring GemFire Cache <Handshaker /0:0:0:0:0:0:0:0:40404 Thread 1> tid=0x34] 
    Entry expiry tasks disabled because the queue became primary. Old messageTimeToLive was: 180
    
    INFO : com.playground.gemfire.CacheLogger - Added [1=nicolas] to the cache
    
    [info 2012/05/02 12:02:54.292 CDT Spring GemFire Cache <ServerConnection on port 40404 Thread 2> tid=0x36] 
    ClientHealthMonitor: Unregistering client with member id identity(70.125.155.138(:loner):57473:4e1b810e:Spring 
    GemFire Cache,connection=1
    "INFO : com.playground.gemfire.CacheLogger - Added [1=nicolas] to the cache" Is the output generated by a listener registered on the Region configured on the server.

    Server Config:
    Code:
    <!-- Cache -->
    <gfe:cache properties-ref="cacheProps" />
    
    <!-- Cache properties -->
    <util:properties id="cacheProps" location="classpath:cache.properties"/>
    
    <!-- Cache Server -->	
    <gfe:cache-server max-threads="10" groups="test-servers" >
        <gfe:subscription-config eviction-type="ENTRY" disk-store="." />
    </gfe:cache-server>
    	
    <!-- Region -->
    <gfe:replicated-region id="userRegion" >
        <gfe:cache-listener>
            <bean class="com.playground.gemfire.CacheLogger"/>
        </gfe:cache-listener>
    </gfe:replicated-region>
    Client Config:
    Code:
    <!-- Client Cache -->
    <gfe:client-cache properties-ref="cacheProps" pool-name="gemfireConnectionPool" />
     
    <!-- Cache properties -->
    <util:properties id="cacheProps" location="classpath:META-INF/props/cache.properties"/>
     	
    <!-- Client Region -->
    <gfe:client-region id="userRegion" pool-name="gemfireConnectionPool" />
        
    <!-- Gemfire template -->
    <bean id="cacheTemplate" class="org.springframework.data.gemfire.GemfireTemplate" p:region-ref="userRegion" />
    	
    <!-- Connection Pool -->
    <gfe:pool id="gemfireConnectionPool" max-connections="20" server-group="test-servers" subscription-enabled="true">
        <gfe:locator host="localhost" port="40404" />
    </gfe:pool>
    On the client I used the GemfireTemplate to execute template.put( 1L, "nicolas" ); and in the server node the listener is called and outputs: "INFO : com.playground.gemfire.CacheLogger - Added [1=nicolas] to the cache"

    I'm not sure of the relevance of the Running in local mode since mcast-port was 0 and locators was empty log line on the client side but seems the members (client/server) are communicating as expected.

    Watch the server console for client connection requests and maybe add a listener to your region on the server config to verify if the cache gets updated.


    nicolas.loriente

    Comment

    Working...
    X