Wes,
When you state "single CQ with multiple listeners", this is limited a to
a single client? From the API docs, I think you can add multiple
listeners receiving the same message within the same client JVM.
--Udo
On 5/09/2016 4:08 PM, Real Wes wrote:
Udo,
I verified that the approach you recommended works. Thanks. Meanwhile,
I also discovered that registering a single CQ with multiple listeners
also works.
Wes
On Sep 5, 2016, at 1:03 AM, Udo Kohlmeyer <ukohlme...@pivotal.io
<mailto:ukohlme...@pivotal.io>> wrote:
Hi there Wes,
The distribution of the same event to multiple registered listeners
is not supported.
If you want both listeners to get the same events you will have to
register multiple CQ's with different names.
--Udo
On 5/09/2016 12:40 PM, Real Wes wrote:
I found out the hard way that if I create 2 CQ’s on the same region
with the same query string, each with a different listener, that the
2nd one will overwrite the first one. However, what I need is that
when I write a single event into a region that multiple listeners fire.
Question: if I have an existing CQ and I want to add another
listener to it, do I need to destroy the first listener and recreate
a new CQ with 2 listeners? Would be nice to be able to just add a
listener.
private CqQuery addListenerToExistingCq(QueryService queryService,
CqQuery cqQuery, DomainEventListener aListener) {
CqAttributes cqa = cqQuery.getCqAttributes();
// Add new listener to existing query
CqAttributesFactory cqAf = new CqAttributesFactory(cqa);
cqAf.addCqListener(aListener);
cqa = cqAf.create();
String cqName = cqQuery.getName();
String query = cqQuery.getQueryString();
try {
if (cqQuery != null) {
if (cqQuery.isRunning()) {
cqQuery.stop();
cqQuery.close();
}
}
cqQuery= queryService.newCq(cqName, query, cqa);
SelectResults sResults = cqQuery.executeWithInitialResults();
Thanks,
Wes Williams