skip to Main Content

TL;DR – Apache Geode CacheListener stops listening after the application starts.

I am trying to set up a listener for Apache Geode. I have created a spring boot project with Web and JPA. I have created a listener that extends CacheListenerAdapter. In the main class, I do a test insert on the region and the listener does work for that one time. After the application starts it doesn’t process the events. I did try insert from the ‘gfsh’ console as well as another Java client. I am including my Listener, main class and logs along. Any help will be really appreciated. Thanks

Listener

@Component
public class GeodeEventListener extends CacheListenerAdapter{

public void afterCreate(EntryEvent event) {
    System.out.println("Created: "+"Key: "+ event.getKey() +" New Value: "+ event.getNewValue());
  }

}

Main Class

@SpringBootApplication
public class GeodelistenerApplication {

@Autowired
private AppConfig appConfig;

@Autowired
private GeodeEventListener geodeEventListener;

public static void main(String[] args) {
    SpringApplication.run(GeodelistenerApplication.class, args);
}

@PostConstruct
public void init(){
    ClientCache cache = new ClientCacheFactory()
            .setPoolSubscriptionEnabled(true)
            .addPoolLocator(appConfig.geodeHost , appConfig.geodePort)
            .create();
    ClientRegionFactory rf = 
    cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
    rf.addCacheListener(geodeEventListener);
    Region alert_status = rf.create(appConfig.region);  
    alert_status.put("test", "test");
 }
}

Logs

[info 2018/07/04 18:05:09.618 SGT <background-preinit> tid=0xb] HV000001: Hibernate Validator 6.0.10.Final

[info 2018/07/04 18:05:09.828 SGT <main> tid=0x1] Starting GeodelistenerApplication on DESKTOP-L4HAU87 with PID 24112 (D:Workgeodelistenertargetclasses started by Username in D:Workgeodelistener)

[info 2018/07/04 18:05:09.830 SGT <main> tid=0x1] No active profile set, falling back to default profiles: default

[info 2018/07/04 18:05:09.893 SGT <main> tid=0x1] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@37313c65: startup date [Wed Jul 04 18:05:09 SGT 2018]; root of context hierarchy

[info 2018/07/04 18:05:11.629 SGT <main> tid=0x1] Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$24ff727c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

[info 2018/07/04 18:05:12.302 SGT <main> tid=0x1] Tomcat initialized with port(s): 8081 (http)

Jul 04, 2018 6:05:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8081"]
Jul 04, 2018 6:05:12 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Jul 04, 2018 6:05:12 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.31
Jul 04, 2018 6:05:12 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:Program FilesJavajdk1.8.0_144bin;C:WINDOWSSunJavabin;C:WINDOWSsystem32;C:WINDOWS;C:/Program Files/Java/jdk1.8.0_144/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_144/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_144/bin/../jre/lib/amd64;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program FilesJavajdk1.8.0_144bin;C:Program FilesPostgreSQL9.6bin;D:WorkSoftwaresapache-maven-3.5.0bin;C:UsersUsernameAppDataLocalAndroidSdktools;C:UsersUsernameAppDataLocalAndroidSdktoolsbin;C:UsersUsernameAppDataLocalAndroidSdkplatform-tools;C:Program FilesGitcmd;C:Program Filesnodejs;;C:Program Files (x86)Bitvise SSH Client;C:WINDOWSSystem32OpenSSH;C:Program Files (x86)Windows Kits8.1Windows Performance Toolkit;C:UsersUsernameAppDataLocalMicrosoftWindowsApps;C:Program FilesMicrosoft VS Codebin;C:UsersUsernameAppDataRoamingnpm;;D:WorkBinarieseclipse;;.]
Jul 04, 2018 6:05:12 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
[info 2018/07/04 18:05:12.488 SGT <localhost-startStop-1> tid=0xe] Root WebApplicationContext: initialization completed in 2595 ms

[info 2018/07/04 18:05:12.655 SGT <localhost-startStop-1> tid=0xe] Servlet dispatcherServlet mapped to [/]

[info 2018/07/04 18:05:12.660 SGT <localhost-startStop-1> tid=0xe] Mapping filter: 'characterEncodingFilter' to: [/*]

[info 2018/07/04 18:05:12.661 SGT <localhost-startStop-1> tid=0xe] Mapping filter: 'hiddenHttpMethodFilter' to: [/*]

[info 2018/07/04 18:05:12.661 SGT <localhost-startStop-1> tid=0xe] Mapping filter: 'httpPutFormContentFilter' to: [/*]

[info 2018/07/04 18:05:12.661 SGT <localhost-startStop-1> tid=0xe] Mapping filter: 'requestContextFilter' to: [/*]

2018-07-04 18:05:12.910  INFO 24112 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2018-07-04 18:05:13.201  INFO 24112 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
[info 2018/07/04 18:05:13.263 SGT <main> tid=0x1] Building JPA container EntityManagerFactory for persistence unit 'default'

[info 2018/07/04 18:05:13.285 SGT <main> tid=0x1] HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]

[info 2018/07/04 18:05:13.453 SGT <main> tid=0x1] HHH000412: Hibernate Core {5.2.17.Final}

[info 2018/07/04 18:05:13.455 SGT <main> tid=0x1] HHH000206: hibernate.properties not found

[info 2018/07/04 18:05:13.506 SGT <main> tid=0x1] HCANN000001: Hibernate Commons Annotations {5.0.1.Final}

[info 2018/07/04 18:05:13.651 SGT <main> tid=0x1] HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect

[info 2018/07/04 18:05:14.292 SGT <main> tid=0x1] Initialized JPA EntityManagerFactory for persistence unit 'default'

[info 2018/07/04 18:05:15.367 SGT <main> tid=0x1] 
---------------------------------------------------------------------------

  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with this
  work for additional information regarding copyright ownership.

  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with the
  License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
  License for the specific language governing permissions and limitations
  under the License.

---------------------------------------------------------------------------
Build-Date: 2018-04-23 14:04:21 -0400
Build-Id: mikestolz 0
Build-Java-Version: 1.8.0_151
Build-Platform: Mac OS X 10.13.4 x86_64
Product-Name: Apache Geode
Product-Version: 1.6.0
Source-Date: 2018-04-19 18:12:58 -0400
Source-Repository: release/1.6.0
Source-Revision: 5ce726bd7b4f8d2648fd011a807a1bcc624ddfa5
Native version: native code unavailable
Running on: /192.168.64.1, 4 cpu(s), amd64 Windows 10 10.0 
Communications version: 85
Process ID: 24112
User: Username
Current dir: D:Workgeodelistener
Home dir: C:UsersUsername
Command Line Parameters:
  -Dfile.encoding=UTF-8
Class Path:
  D:Workgeodelistenertargetclasses
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-starter-data-jpa2.0.3.RELEASEspring-boot-starter-data-jpa-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-starter2.0.3.RELEASEspring-boot-starter-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot2.0.3.RELEASEspring-boot-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-autoconfigure2.0.3.RELEASEspring-boot-autoconfigure-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-starter-logging2.0.3.RELEASEspring-boot-starter-logging-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar
  C:UsersUsername.m2repositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar
  C:UsersUsername.m2repositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar
  C:UsersUsername.m2repositoryorgyamlsnakeyaml1.19snakeyaml-1.19.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-starter-aop2.0.3.RELEASEspring-boot-starter-aop-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-aop5.0.7.RELEASEspring-aop-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgaspectjaspectjweaver1.8.13aspectjweaver-1.8.13.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-starter-jdbc2.0.3.RELEASEspring-boot-starter-jdbc-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositorycomzaxxerHikariCP2.7.9HikariCP-2.7.9.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-jdbc5.0.7.RELEASEspring-jdbc-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorghibernatehibernate-core5.2.17.Finalhibernate-core-5.2.17.Final.jar
  C:UsersUsername.m2repositoryorgjbossloggingjboss-logging3.3.2.Finaljboss-logging-3.3.2.Final.jar
  C:UsersUsername.m2repositoryorghibernatejavaxpersistencehibernate-jpa-2.1-api1.0.2.Finalhibernate-jpa-2.1-api-1.0.2.Final.jar
  C:UsersUsername.m2repositoryorgjavassistjavassist3.22.0-GAjavassist-3.22.0-GA.jar
  C:UsersUsername.m2repositoryorgjbossjandex2.0.3.Finaljandex-2.0.3.Final.jar
  C:UsersUsername.m2repositorycomfasterxmlclassmate1.3.4classmate-1.3.4.jar
  C:UsersUsername.m2repositorydom4jdom4j1.6.1dom4j-1.6.1.jar
  C:UsersUsername.m2repositoryorghibernatecommonhibernate-commons-annotations5.0.1.Finalhibernate-commons-annotations-5.0.1.Final.jar
  C:UsersUsername.m2repositoryjavaxtransactionjavax.transaction-api1.2javax.transaction-api-1.2.jar
  C:UsersUsername.m2repositoryorgspringframeworkdataspring-data-jpa2.0.8.RELEASEspring-data-jpa-2.0.8.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkdataspring-data-commons2.0.8.RELEASEspring-data-commons-2.0.8.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-orm5.0.7.RELEASEspring-orm-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-context5.0.7.RELEASEspring-context-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-tx5.0.7.RELEASEspring-tx-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-beans5.0.7.RELEASEspring-beans-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-aspects5.0.7.RELEASEspring-aspects-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositorymysqlmysql-connector-java5.1.46mysql-connector-java-5.1.46.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-starter-web2.0.3.RELEASEspring-boot-starter-web-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-starter-json2.0.3.RELEASEspring-boot-starter-json-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositorycomfasterxmljacksondatatypejackson-datatype-jdk82.9.6jackson-datatype-jdk8-2.9.6.jar
  C:UsersUsername.m2repositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.9.6jackson-datatype-jsr310-2.9.6.jar
  C:UsersUsername.m2repositorycomfasterxmljacksonmodulejackson-module-parameter-names2.9.6jackson-module-parameter-names-2.9.6.jar
  C:UsersUsername.m2repositoryorgspringframeworkbootspring-boot-starter-tomcat2.0.3.RELEASEspring-boot-starter-tomcat-2.0.3.RELEASE.jar
  C:UsersUsername.m2repositoryorgapachetomcatembedtomcat-embed-core8.5.31tomcat-embed-core-8.5.31.jar
  C:UsersUsername.m2repositoryorgapachetomcatembedtomcat-embed-el8.5.31tomcat-embed-el-8.5.31.jar
  C:UsersUsername.m2repositoryorgapachetomcatembedtomcat-embed-websocket8.5.31tomcat-embed-websocket-8.5.31.jar
  C:UsersUsername.m2repositoryorghibernatevalidatorhibernate-validator6.0.10.Finalhibernate-validator-6.0.10.Final.jar
  C:UsersUsername.m2repositoryjavaxvalidationvalidation-api2.0.1.Finalvalidation-api-2.0.1.Final.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-web5.0.7.RELEASEspring-web-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-webmvc5.0.7.RELEASEspring-webmvc-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-expression5.0.7.RELEASEspring-expression-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-core5.0.7.RELEASEspring-core-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgspringframeworkspring-jcl5.0.7.RELEASEspring-jcl-5.0.7.RELEASE.jar
  C:UsersUsername.m2repositoryorgapachegeodegeode-core1.6.0geode-core-1.6.0.jar
  C:UsersUsername.m2repositoryantlrantlr2.7.7antlr-2.7.7.jar
  C:UsersUsername.m2repositorycomgithubstephencfindbugsfindbugs-annotations1.3.9-1findbugs-annotations-1.3.9-1.jar
  C:UsersUsername.m2repositoryorgjgroupsjgroups3.6.14.Finaljgroups-3.6.14.Final.jar
  C:UsersUsername.m2repositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar
  C:UsersUsername.m2repositorycomfasterxmljacksoncorejackson-databind2.9.6jackson-databind-2.9.6.jar
  C:UsersUsername.m2repositorycomfasterxmljacksoncorejackson-core2.9.6jackson-core-2.9.6.jar
  C:UsersUsername.m2repositorycommons-iocommons-io2.6commons-io-2.6.jar
  C:UsersUsername.m2repositorycommons-validatorcommons-validator1.6commons-validator-1.6.jar
  C:UsersUsername.m2repositorycommons-beanutilscommons-beanutils1.9.2commons-beanutils-1.9.2.jar
  C:UsersUsername.m2repositorycommons-loggingcommons-logging1.2commons-logging-1.2.jar
  C:UsersUsername.m2repositorycommons-collectionscommons-collections3.2.2commons-collections-3.2.2.jar
  C:UsersUsername.m2repositorycommons-digestercommons-digester2.1commons-digester-2.1.jar
  C:UsersUsername.m2repositorycommons-langcommons-lang2.6commons-lang-2.6.jar
  C:UsersUsername.m2repositoryitunimidsifastutil8.1.1fastutil-8.1.1.jar
  C:UsersUsername.m2repositoryjavaxresourcejavax.resource-api1.7javax.resource-api-1.7.jar
  C:UsersUsername.m2repositorynetjavadevjnajna4.5.1jna-4.5.1.jar
  C:UsersUsername.m2repositorynetsfjopt-simplejopt-simple5.0.4jopt-simple-5.0.4.jar
  C:UsersUsername.m2repositoryorgapachelogginglog4jlog4j-api2.10.0log4j-api-2.10.0.jar
  C:UsersUsername.m2repositoryorgapachelogginglog4jlog4j-core2.10.0log4j-core-2.10.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-core1.4.0shiro-core-1.4.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-lang1.4.0shiro-lang-1.4.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-cache1.4.0shiro-cache-1.4.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-crypto-hash1.4.0shiro-crypto-hash-1.4.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-crypto-core1.4.0shiro-crypto-core-1.4.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-crypto-cipher1.4.0shiro-crypto-cipher-1.4.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-config-core1.4.0shiro-config-core-1.4.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-config-ogdl1.4.0shiro-config-ogdl-1.4.0.jar
  C:UsersUsername.m2repositoryorgapacheshiroshiro-event1.4.0shiro-event-1.4.0.jar
  C:UsersUsername.m2repositoryiogithublukehutchfast-classpath-scanner2.18.1fast-classpath-scanner-2.18.1.jar
  C:UsersUsername.m2repositorycomhealthmarketsciencermiiormiio2.1.2rmiio-2.1.2.jar
  C:UsersUsername.m2repositoryorgapachegeodegeode-common1.6.0geode-common-1.6.0.jar
  C:UsersUsername.m2repositoryorgapachegeodegeode-json1.6.0geode-json-1.6.0.jar
  C:UsersUsername.m2repositoryorgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar
  C:UsersUsername.m2repositoryorgapachegeodegeode-cq1.6.0geode-cq-1.6.0.jar
Library Path:
  C:Program FilesJavajdk1.8.0_144bin
  C:WINDOWSSunJavabin
  C:WINDOWSsystem32
  C:WINDOWS
  C:/Program Files/Java/jdk1.8.0_144/bin/../jre/bin/server
  C:/Program Files/Java/jdk1.8.0_144/bin/../jre/bin
  C:/Program Files/Java/jdk1.8.0_144/bin/../jre/lib/amd64
  C:WINDOWSsystem32
  C:WINDOWS
  C:WINDOWSSystem32Wbem
  C:WINDOWSSystem32WindowsPowerShellv1.0
  C:Program FilesJavajdk1.8.0_144bin
  C:Program FilesPostgreSQL9.6bin
  D:WorkSoftwaresapache-maven-3.5.0bin
  C:UsersUsernameAppDataLocalAndroidSdktools
  C:UsersUsernameAppDataLocalAndroidSdktoolsbin
  C:UsersUsernameAppDataLocalAndroidSdkplatform-tools
  C:Program FilesGitcmd
  C:Program Filesnodejs
  C:Program Files (x86)Bitvise SSH Client
  C:WINDOWSSystem32OpenSSH
  C:Program Files (x86)Windows Kits8.1Windows Performance Toolkit
  C:UsersUsernameAppDataLocalMicrosoftWindowsApps
  C:Program FilesMicrosoft VS Codebin
  C:UsersUsernameAppDataRoamingnpm
  D:WorkBinarieseclipse
  .
System Properties:
    PID = 24112
    awt.toolkit = sun.awt.windows.WToolkit
    catalina.base = C:UsersUsernameAppDataLocalTemptomcat.1188691188621018585.8081
    catalina.home = C:UsersUsernameAppDataLocalTemptomcat.1188691188621018585.8081
    catalina.useNaming = false
    com.zaxxer.hikari.pool_number = 1
    file.encoding = UTF-8
    file.encoding.pkg = sun.io
    file.separator = 
    java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
    java.awt.headless = true
    java.awt.printerjob = sun.awt.windows.WPrinterJob
    java.class.version = 52.0
    java.endorsed.dirs = C:Program FilesJavajdk1.8.0_144jrelibendorsed
    java.ext.dirs = C:Program FilesJavajdk1.8.0_144jrelibext;C:WINDOWSSunJavalibext
    java.home = C:Program FilesJavajdk1.8.0_144jre
    java.io.tmpdir = C:UsersPRIYAA~1AppDataLocalTemp
    java.runtime.name = Java(TM) SE Runtime Environment
    java.runtime.version = 1.8.0_144-b01
    java.specification.name = Java Platform API Specification
    java.specification.vendor = Oracle Corporation
    java.specification.version = 1.8
    java.vendor = Oracle Corporation
    java.vendor.url = http://java.oracle.com/
    java.vendor.url.bug = http://bugreport.sun.com/bugreport/
    java.version = 1.8.0_144
    java.vm.info = mixed mode
    java.vm.name = Java HotSpot(TM) 64-Bit Server VM
    java.vm.specification.name = Java Virtual Machine Specification
    java.vm.specification.vendor = Oracle Corporation
    java.vm.specification.version = 1.8
    java.vm.vendor = Oracle Corporation
    java.vm.version = 25.144-b01
    line.separator = 

    os.version = 10.0
    path.separator = ;
    spring.beaninfo.ignore = true
    sun.arch.data.model = 64
    sun.boot.class.path = C:Program FilesJavajdk1.8.0_144jrelibresources.jar;C:Program FilesJavajdk1.8.0_144jrelibrt.jar;C:Program FilesJavajdk1.8.0_144jrelibsunrsasign.jar;C:Program FilesJavajdk1.8.0_144jrelibjsse.jar;C:Program FilesJavajdk1.8.0_144jrelibjce.jar;C:Program FilesJavajdk1.8.0_144jrelibcharsets.jar;C:Program FilesJavajdk1.8.0_144jrelibjfr.jar;C:Program FilesJavajdk1.8.0_144jreclasses
    sun.boot.library.path = C:Program FilesJavajdk1.8.0_144jrebin
    sun.cpu.endian = little
    sun.cpu.isalist = amd64
    sun.desktop = windows
    sun.io.unicode.encoding = UnicodeLittle
    sun.java.command = com.onwards.geodelistener.GeodelistenerApplication
    sun.java.launcher = SUN_STANDARD
    sun.jnu.encoding = Cp1252
    sun.management.compiler = HotSpot 64-Bit Tiered Compilers
    sun.nio.ch.bugLevel = 
    sun.os.patch.level = 
    user.country = SG
    user.language = en
    user.script = 
    user.timezone = Asia/Singapore
    user.variant = 
Log4J 2 Configuration:
    jar:file:/C:/Users/Priya%20Anil/.m2/repository/org/apache/geode/geode-core/1.6.0/geode-core-1.6.0.jar!/log4j2.xml
---------------------------------------------------------------------------


[info 2018/07/04 18:05:15.378 SGT <main> tid=0x1] initializing InternalDataSerializer with 1 services

[info 2018/07/04 18:05:24.519 SGT <Thread-2 StatSampler> tid=0x18] Disabling statistic archival.

[info 2018/07/04 18:05:24.545 SGT <main> tid=0x1] Running in client mode

[info 2018/07/04 18:05:24.688 SGT <main> tid=0x1] deploying jars received from cluster configuration

[info 2018/07/04 18:05:24.745 SGT <main> tid=0x1] AutoConnectionSource UpdateLocatorListTask started with interval=10,000 ms.

[info 2018/07/04 18:05:24.759 SGT <poolTimer-DEFAULT-3> tid=0x21] Updating membership port.  Port changed from 0 to 58,033.  ID is now DESKTOP-L4HAU87(24112:loner):0:fdd0c064

[info 2018/07/04 18:05:24.799 SGT <main> tid=0x1] Pool DEFAULT started with multiuser-authentication=false

[info 2018/07/04 18:05:24.807 SGT <Cache Client Updater Thread  on DESKTOP-L4HAU87(serverA:44988)<v1>:1025 port 40404> tid=0x23] Cache Client Updater Thread  on DESKTOP-L4HAU87(serverA:44988)<v1>:1025 port 40404 (DESKTOP-L4HAU87:40404) : ready to process messages.

Created: Key: test New Value: test
[info 2018/07/04 18:05:25.591 SGT <main> tid=0x1] Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

[info 2018/07/04 18:05:25.933 SGT <main> tid=0x1] Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@37313c65: startup date [Wed Jul 04 18:05:09 SGT 2018]; root of context hierarchy

[warn 2018/07/04 18:05:25.999 SGT <main> tid=0x1] spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

[info 2018/07/04 18:05:26.056 SGT <main> tid=0x1] Mapped "{[/api/alert_status/{id}],methods=[GET]}" onto public com.onwards.geodelistener.model.AlertStatus com.onwards.geodelistener.controller.AlertStatusController.getAlertStatus(java.lang.Long)

[info 2018/07/04 18:05:26.057 SGT <main> tid=0x1] Mapped "{[/api/alert_status/{id}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity<?> com.onwards.geodelistener.controller.AlertStatusController.deleteAlertStatus(java.lang.Long)

[info 2018/07/04 18:05:26.058 SGT <main> tid=0x1] Mapped "{[/api/alert_status/{id}],methods=[PUT]}" onto public com.onwards.geodelistener.model.AlertStatus com.onwards.geodelistener.controller.AlertStatusController.updateAlertStatus(java.lang.Long,com.onwards.geodelistener.model.AlertStatus)

[info 2018/07/04 18:05:26.058 SGT <main> tid=0x1] Mapped "{[/api/alert_status],methods=[GET]}" onto public java.util.List<com.onwards.geodelistener.model.AlertStatus> com.onwards.geodelistener.controller.AlertStatusController.getAllAlertStatus()

[info 2018/07/04 18:05:26.058 SGT <main> tid=0x1] Mapped "{[/api/alert_status],methods=[POST]}" onto public com.onwards.geodelistener.model.AlertStatus com.onwards.geodelistener.controller.AlertStatusController.createAlertStatus(com.onwards.geodelistener.model.AlertStatus)

[info 2018/07/04 18:05:26.062 SGT <main> tid=0x1] Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)

[info 2018/07/04 18:05:26.064 SGT <main> tid=0x1] Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)

[info 2018/07/04 18:05:26.119 SGT <main> tid=0x1] Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

[info 2018/07/04 18:05:26.119 SGT <main> tid=0x1] Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

[info 2018/07/04 18:05:26.506 SGT <main> tid=0x1] Registering beans for JMX exposure on startup

[info 2018/07/04 18:05:26.508 SGT <main> tid=0x1] Bean with name 'dataSource' has been autodetected for JMX exposure

[info 2018/07/04 18:05:26.516 SGT <main> tid=0x1] Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]

Jul 04, 2018 6:05:26 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8081"]
Jul 04, 2018 6:05:26 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
[info 2018/07/04 18:05:26.561 SGT <main> tid=0x1] Tomcat started on port(s): 8081 (http) with context path ''

[info 2018/07/04 18:05:26.567 SGT <main> tid=0x1] Started GeodelistenerApplication in 17.14 seconds (JVM running for 18.472)

[info 2018/07/04 18:05:29.274 SGT <poolTimer-DEFAULT-2> tid=0x20] AutoConnectionSource discovered new locators [DESKTOP-L4HAU87/192.168.64.1:9001]

As you may miss the sysout from listener, I am adding it below
Created: Key: test New Value: test.
I get this message as a result of the insert from the main function. But no further inserts from gfsh/java client is captured by the listener

2

Answers


  1. Chosen as BEST ANSWER

    @Urizen's answer helped me figure out the problem. I have changed my listener to a CqStatusListener from CacheListenerAdapter. Client Cache as the name suggests it will receive events happening on the local cache only. CqListener needs a continuous query that will be run against every entry created on the server and if it satisfies the query an event will be returned to the listener.

    Listener

    @Component
    public class GeodeEventListener implements CqStatusListener{
    
     @Override
     public void onEvent(CqEvent cqEvent) {
        //do your thing
     }
    
     @Override
     public void onError(CqEvent cqEvent) {
        //do your thing 
     }
    
     @Override
     public void onCqDisconnected() {
        //do your thing 
     }
    
     @Override
     public void onCqConnected() {
        //do your thing 
     }
    }
    

    init method

    @PostConstruct
    public void init(){
        ClientCache cache = new ClientCacheFactory()
                .setPoolSubscriptionEnabled(true)
                .addPoolLocator(appConfig.geodeHost , appConfig.geodePort)
                .create();
        CqAttributesFactory cqf = new CqAttributesFactory();
        cqf.addCqListener(geodeEventListener);
        CqAttributes cqa = cqf.create();
        try {
            CqQuery cq = cache.getQueryService().newCq("query", "select * from /"+appConfig.region, cqa);
            SelectResults rs = cq.executeWithInitialResults();
        } catch (Exception e) {
            e.printStackTrace();
        } 
    }
    

  2. The listener is configured on the client cache so it will only get executed whenever it receives an event from the local cache. I can see that you have configured the pool with subscription-enabled set as true, but I don’t see any configuration related to the entries on which the client is interested, meaning that the client won’t receive any updates about entries that have changed on the server side (either through a gfsh put or a region.put() from another client and/or server). You’re basically missing the last configuration step, please have a look at Configuring Client/Server Event Messaging for the details.

    Hope this helps.
    Best regards.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search