Apache Geode CacheListenerAdapter не работает
TL; DR - Apache Geode CacheListener прекращает прослушивание после запуска приложения.
Я пытаюсь настроить слушатель для Apache Geode. Я создал весенний загрузочный проект с Web и JPA. Я создал слушатель, который расширяет CacheListenerAdapter. В основном классе я делаю тестовую вставку по региону, и слушатель работает один раз. После запуска приложения оно не обрабатывает события. Я попытался вставить из консоли 'gfsh', а также другой клиент Java. Я включаю мой Слушатель, основной класс и журналы. Любая помощь будет по достоинству оценена. Спасибо
слушатель
@Component
public class GeodeEventListener extends CacheListenerAdapter{
public void afterCreate(EntryEvent event) {
System.out.println("Created: "+"Key: "+ event.getKey() +" New Value: "+ event.getNewValue());
}
}
Основной класс
@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");
}
}
бревна
[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:\Work\geodelistener\target\classes started by Username in D:\Work\geodelistener)
[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 Files\Java\jdk1.8.0_144\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;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:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files\PostgreSQL\9.6\bin;D:\Work\Softwares\apache-maven-3.5.0\bin;C:\Users\Username\AppData\Local\Android\Sdk\tools;C:\Users\Username\AppData\Local\Android\Sdk\tools\bin;C:\Users\Username\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;;C:\Program Files (x86)\Bitvise SSH Client;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\Username\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\Username\AppData\Roaming\npm;;D:\Work\Binaries\eclipse;;.]
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:\Work\geodelistener
Home dir: C:\Users\Username
Command Line Parameters:
-Dfile.encoding=UTF-8
Class Path:
D:\Work\geodelistener\target\classes
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\2.0.3.RELEASE\spring-boot-starter-data-jpa-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.3.RELEASE\spring-boot-starter-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot\2.0.3.RELEASE\spring-boot-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.3.RELEASE\spring-boot-autoconfigure-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.3.RELEASE\spring-boot-starter-logging-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar
C:\Users\Username\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar
C:\Users\Username\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar
C:\Users\Username\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-starter-aop\2.0.3.RELEASE\spring-boot-starter-aop-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-aop\5.0.7.RELEASE\spring-aop-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.0.3.RELEASE\spring-boot-starter-jdbc-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\com\zaxxer\HikariCP\2.7.9\HikariCP-2.7.9.jar
C:\Users\Username\.m2\repository\org\springframework\spring-jdbc\5.0.7.RELEASE\spring-jdbc-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\hibernate\hibernate-core\5.2.17.Final\hibernate-core-5.2.17.Final.jar
C:\Users\Username\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar
C:\Users\Username\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.2.Final\hibernate-jpa-2.1-api-1.0.2.Final.jar
C:\Users\Username\.m2\repository\org\javassist\javassist\3.22.0-GA\javassist-3.22.0-GA.jar
C:\Users\Username\.m2\repository\org\jboss\jandex\2.0.3.Final\jandex-2.0.3.Final.jar
C:\Users\Username\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar
C:\Users\Username\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar
C:\Users\Username\.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.0.1.Final\hibernate-commons-annotations-5.0.1.Final.jar
C:\Users\Username\.m2\repository\javax\transaction\javax.transaction-api\1.2\javax.transaction-api-1.2.jar
C:\Users\Username\.m2\repository\org\springframework\data\spring-data-jpa\2.0.8.RELEASE\spring-data-jpa-2.0.8.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\data\spring-data-commons\2.0.8.RELEASE\spring-data-commons-2.0.8.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-orm\5.0.7.RELEASE\spring-orm-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-context\5.0.7.RELEASE\spring-context-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-tx\5.0.7.RELEASE\spring-tx-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-beans\5.0.7.RELEASE\spring-beans-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-aspects\5.0.7.RELEASE\spring-aspects-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.0.3.RELEASE\spring-boot-starter-web-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.0.3.RELEASE\spring-boot-starter-json-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.6\jackson-datatype-jdk8-2.9.6.jar
C:\Users\Username\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.6\jackson-datatype-jsr310-2.9.6.jar
C:\Users\Username\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.6\jackson-module-parameter-names-2.9.6.jar
C:\Users\Username\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.3.RELEASE\spring-boot-starter-tomcat-2.0.3.RELEASE.jar
C:\Users\Username\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.31\tomcat-embed-core-8.5.31.jar
C:\Users\Username\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.31\tomcat-embed-el-8.5.31.jar
C:\Users\Username\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.31\tomcat-embed-websocket-8.5.31.jar
C:\Users\Username\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.10.Final\hibernate-validator-6.0.10.Final.jar
C:\Users\Username\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar
C:\Users\Username\.m2\repository\org\springframework\spring-web\5.0.7.RELEASE\spring-web-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-webmvc\5.0.7.RELEASE\spring-webmvc-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-expression\5.0.7.RELEASE\spring-expression-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-core\5.0.7.RELEASE\spring-core-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\springframework\spring-jcl\5.0.7.RELEASE\spring-jcl-5.0.7.RELEASE.jar
C:\Users\Username\.m2\repository\org\apache\geode\geode-core\1.6.0\geode-core-1.6.0.jar
C:\Users\Username\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar
C:\Users\Username\.m2\repository\com\github\stephenc\findbugs\findbugs-annotations\1.3.9-1\findbugs-annotations-1.3.9-1.jar
C:\Users\Username\.m2\repository\org\jgroups\jgroups\3.6.14.Final\jgroups-3.6.14.Final.jar
C:\Users\Username\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar
C:\Users\Username\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.6\jackson-databind-2.9.6.jar
C:\Users\Username\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.6\jackson-core-2.9.6.jar
C:\Users\Username\.m2\repository\commons-io\commons-io\2.6\commons-io-2.6.jar
C:\Users\Username\.m2\repository\commons-validator\commons-validator\1.6\commons-validator-1.6.jar
C:\Users\Username\.m2\repository\commons-beanutils\commons-beanutils\1.9.2\commons-beanutils-1.9.2.jar
C:\Users\Username\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar
C:\Users\Username\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar
C:\Users\Username\.m2\repository\commons-digester\commons-digester\2.1\commons-digester-2.1.jar
C:\Users\Username\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar
C:\Users\Username\.m2\repository\it\unimi\dsi\fastutil\8.1.1\fastutil-8.1.1.jar
C:\Users\Username\.m2\repository\javax\resource\javax.resource-api\1.7\javax.resource-api-1.7.jar
C:\Users\Username\.m2\repository\net\java\dev\jna\jna\4.5.1\jna-4.5.1.jar
C:\Users\Username\.m2\repository\net\sf\jopt-simple\jopt-simple\5.0.4\jopt-simple-5.0.4.jar
C:\Users\Username\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar
C:\Users\Username\.m2\repository\org\apache\logging\log4j\log4j-core\2.10.0\log4j-core-2.10.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-core\1.4.0\shiro-core-1.4.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-lang\1.4.0\shiro-lang-1.4.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-cache\1.4.0\shiro-cache-1.4.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-crypto-hash\1.4.0\shiro-crypto-hash-1.4.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-crypto-core\1.4.0\shiro-crypto-core-1.4.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-crypto-cipher\1.4.0\shiro-crypto-cipher-1.4.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-config-core\1.4.0\shiro-config-core-1.4.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-config-ogdl\1.4.0\shiro-config-ogdl-1.4.0.jar
C:\Users\Username\.m2\repository\org\apache\shiro\shiro-event\1.4.0\shiro-event-1.4.0.jar
C:\Users\Username\.m2\repository\io\github\lukehutch\fast-classpath-scanner\2.18.1\fast-classpath-scanner-2.18.1.jar
C:\Users\Username\.m2\repository\com\healthmarketscience\rmiio\rmiio\2.1.2\rmiio-2.1.2.jar
C:\Users\Username\.m2\repository\org\apache\geode\geode-common\1.6.0\geode-common-1.6.0.jar
C:\Users\Username\.m2\repository\org\apache\geode\geode-json\1.6.0\geode-json-1.6.0.jar
C:\Users\Username\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar
C:\Users\Username\.m2\repository\org\apache\geode\geode-cq\1.6.0\geode-cq-1.6.0.jar
Library Path:
C:\Program Files\Java\jdk1.8.0_144\bin
C:\WINDOWS\Sun\Java\bin
C:\WINDOWS\system32
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:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\Program Files\Java\jdk1.8.0_144\bin
C:\Program Files\PostgreSQL\9.6\bin
D:\Work\Softwares\apache-maven-3.5.0\bin
C:\Users\Username\AppData\Local\Android\Sdk\tools
C:\Users\Username\AppData\Local\Android\Sdk\tools\bin
C:\Users\Username\AppData\Local\Android\Sdk\platform-tools
C:\Program Files\Git\cmd
C:\Program Files\nodejs\
C:\Program Files (x86)\Bitvise SSH Client
C:\WINDOWS\System32\OpenSSH\
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\
C:\Users\Username\AppData\Local\Microsoft\WindowsApps
C:\Program Files\Microsoft VS Code\bin
C:\Users\Username\AppData\Roaming\npm
D:\Work\Binaries\eclipse
.
System Properties:
PID = 24112
awt.toolkit = sun.awt.windows.WToolkit
catalina.base = C:\Users\Username\AppData\Local\Temp\tomcat.1188691188621018585.8081
catalina.home = C:\Users\Username\AppData\Local\Temp\tomcat.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 Files\Java\jdk1.8.0_144\jre\lib\endorsed
java.ext.dirs = C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
java.home = C:\Program Files\Java\jdk1.8.0_144\jre
java.io.tmpdir = C:\Users\PRIYAA~1\AppData\Local\Temp\
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 Files\Java\jdk1.8.0_144\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_144\jre\classes
sun.boot.library.path = C:\Program Files\Java\jdk1.8.0_144\jre\bin
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]
Поскольку вы можете пропустить sysout от слушателя, я добавляю его ниже Created: Key: test New Value: test. Я получаю это сообщение в результате вставки из основной функции. Но никакие дальнейшие вставки от клиента gfsh/java не перехвачены слушателем
2 ответа
Слушатель настроен на кеше клиента, поэтому он будет выполняться только тогда, когда он получит событие из локального кеша. Я вижу, что вы настроили пул с subscription-enabled
установить как true
, но я не вижу никакой конфигурации, связанной с записями, в которых заинтересован клиент, а это означает, что клиент не будет получать никаких обновлений о записях, которые изменились на стороне сервера (либо через gfsh put
или region.put()
с другого клиента и / или сервера). По сути, вы пропустили последний шаг настройки, пожалуйста, ознакомьтесь с разделом " Конфигурирование обмена сообщениями о событиях клиент / сервер".
Надеюсь это поможет. С наилучшими пожеланиями.
Ответ @ Уризена помог мне разобраться в проблеме. Я изменил мой слушатель на CqStatusListener из CacheListenerAdapter. Клиентский кэш, как следует из названия, будет получать события, происходящие только в локальном кеше. CqListener нужен непрерывный запрос, который будет выполняться для каждой записи, созданной на сервере, и если он удовлетворяет запросу, событие будет возвращено слушателю.
слушатель
@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
@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();
}
}