That’s true. Thanks John! I realized the issue while creating the demo! My class was marked as ‘@Transaction’ and I was creating listener bean in spring file as well, due to which same event was delivered to multiple instances of same class.
Apologies for inconvenience! Thanks & Regards, Dharam From: John Blum [mailto:[email protected]] Sent: Tuesday, December 13, 2016 10:07 AM To: [email protected] Cc: [email protected] Subject: Re: Issue with message delivery in CQListener GemfireTemplate does not matter. It is just a facade<https://github.com/spring-projects/spring-data-gemfire/blob/1.0.0.APACHE-GEODE-INCUBATING-RELEASE/src/main/java/org/springframework/data/gemfire/GemfireTemplate.java#L186-L193> [1] around the Region API (Region.put(key, value)). [1] https://github.com/spring-projects/spring-data-gemfire/blob/1.0.0.APACHE-GEODE-INCUBATING-RELEASE/src/main/java/org/springframework/data/gemfire/GemfireTemplate.java#L186-L193 On Mon, Dec 12, 2016 at 7:52 PM, Thacker, Dharam <[email protected]<mailto:[email protected]>> wrote: Sure. Why I need to remove value from /Event region? There are various events coming from upstream denoting what changes to be made for cache wrapped as generic event in /Event region. Dedicated listener using interest query (Select * from /Event where (someConditionForMe is true)) are already watching /Event region as continuous query listeners. Once they process the event, it should be removed from /Event region as clean up. I would say /Event just works as kind of queue/topic for a use case here. Even if I comment my code not to remove event entry from region, I still see listener logs with 2 CREATE events. This is really strange! I can send small demo separately. I am putting event into region using GemfireTemplate though! public void handleEvent(CqEvent cqEvent){ if(cqEvent.getBaseOperation().isCreate()) { logger.info("Event received with BaseOperation: {}, EventKey: {}", cqEvent.getBaseOperation(), cqEvent.getKey()); EVent event = (Event)cqEvent.getNewValue(); logger.info("Event : {}",print(event)); } [cqListenerContainer-1] INFO c.j.r.d.c.XXXEventListener Event received with BaseOperation: CREATE, EventKey: 0980abd4-5293-4b9b-98e7-2b8ace18c5e8 [cqListenerContainer-1] INFO c.j.r.d.c. XXXEventListener Event : <Event><Uuid>0980abd4-5293-4b9b-98e7-2b8ace18c5e8</Uuid></Event> [cqListenerContainer-1] INFO c.j.r.d.c. XXXEventListener Event received with BaseOperation: CREATE, EventKey: 0980abd4-5293-4b9b-98e7-2b8ace18c5e8 [cqListenerContainer-1] INFO c.j.r.d.c. XXXEventListener Event : <Event><Uuid>0980abd4-5293-4b9b-98e7-2b8ace18c5e8</Uuid></Event> Thanks & Regards, Dharam From: Jason Huynh [mailto:[email protected]<mailto:[email protected]>] Sent: Tuesday, December 13, 2016 1:50 AM To: [email protected]<mailto:[email protected]> Cc: [email protected]<mailto:[email protected]> Subject: Re: Issue with message delivery in CQListener Hi Dharam, Would you be able to provide more information? From the provided code, I am unable to determine why/how a duplicate create event is being sent. It doesn't look like that should be happening. Is there a reason why you are removing the value in the cqListener? I would assume that ends up invoking another cq event back to the listener but as a destroy? -Jason On Mon, Dec 12, 2016 at 4:18 AM, Thacker, Dharam <[email protected]<mailto:[email protected]>> wrote: Hi Team, I am facing strange issue with Cq listener. As sown below, same event is sent to cq listener client 2 times. Could someone help me to spot if anything wrong here? Steps I follow, Rest Service: // create event from client via web service eventTemplate.put(event.getUuid(),event); Cqlistener: public void handleEvent(CqEvent cqEvent){ if(cqEvent.getBaseOperation().isCreate()) { logger.info("Event received with BaseOperation: {}, EventKey: {}", cqEvent.getBaseOperation(), cqEvent.getKey()); EVent event = (Event)cqEvent.getNewValue(); logger.info("Event : {}",print(event)); gemfireTemplate.remove(event.getUuid()); } } <gfe:cq-listener-container id="cqListenerContainer" cache="client-cache"> <gfe:listener ref="XXXEventListener" query="SELECT * FROM /Event"/> </gfe:cq-listener-container> [cqListenerContainer-1] INFO c.j.r.d.c.XXXEventListener Event received with BaseOperation: CREATE, EventKey: 0980abd4-5293-4b9b-98e7-2b8ace18c5e8 [cqListenerContainer-1] INFO c.j.r.d.c. XXXEventListener Event : <Event><Uuid>0980abd4-5293-4b9b-98e7-2b8ace18c5e8</Uuid></Event> [cqListenerContainer-1] INFO c.j.r.d.c. XXXEventListener Event received with BaseOperation: CREATE, EventKey: 0980abd4-5293-4b9b-98e7-2b8ace18c5e8 [cqListenerContainer-1] INFO c.j.r.d.c. XXXEventListener Event : <Event><Uuid>0980abd4-5293-4b9b-98e7-2b8ace18c5e8</Uuid></Event> Thanks & Regards, Dharam This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email -- -John john.blum10101 (skype) This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email
