use of com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId in project coherence-spring by coherence-community.
the class CoherenceTopicListenerTest method shouldCommitWithSyncStrategy.
@Test
void shouldCommitWithSyncStrategy() throws Exception {
NamedTopic<String> topic = this.coherence.getSession().getTopic("TwentySync");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);
try (Publisher<String> publisher = topic.createPublisher()) {
for (int i = 0; i < publisher.getChannelCount(); i++) {
publisher.publish("test").get(1, TimeUnit.MINUTES);
}
Eventually.assertDeferred(() -> this.listenerSix.countSync.get(), is(not(0)));
Eventually.assertDeferred(() -> caches.isCommitted(groupId, this.listenerSix.element.getChannel(), this.listenerSix.element.getPosition()), is(true));
}
}
use of com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId in project coherence-spring by coherence-community.
the class CoherenceTopicListenerTest method shouldCommitWithDefaultStrategy.
@Test
void shouldCommitWithDefaultStrategy() throws Exception {
NamedTopic<String> topic = this.coherence.getSession().getTopic("TwentyDefault");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);
try (Publisher<String> publisher = topic.createPublisher()) {
for (int i = 0; i < publisher.getChannelCount(); i++) {
publisher.publish("test").get(1, TimeUnit.MINUTES);
}
Eventually.assertDeferred(() -> this.listenerSix.countDefault.get(), is(not(0)));
Eventually.assertDeferred(() -> caches.isCommitted(groupId, this.listenerSix.element.getChannel(), this.listenerSix.element.getPosition()), is(true));
}
}
use of com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId in project micronaut-coherence by micronaut-projects.
the class CoherenceTopicListenerTest method shouldCommitWithSyncStrategy.
@Test
public void shouldCommitWithSyncStrategy() throws Exception {
NamedTopic<String> topic = coherence.getSession().getTopic("TwentySync");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);
try (Publisher<String> publisher = topic.createPublisher()) {
for (int i = 0; i < publisher.getChannelCount(); i++) {
publisher.publish("test").get(1, TimeUnit.MINUTES);
}
Eventually.assertDeferred(() -> listenerSix.countSync.get(), is(not(0)));
Eventually.assertDeferred(() -> caches.isCommitted(groupId, listenerSix.element.getChannel(), listenerSix.element.getPosition()), is(true));
}
}
use of com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId in project micronaut-coherence by micronaut-projects.
the class CoherenceTopicListenerTest method shouldCommitWithManualStrategy.
@Test
public void shouldCommitWithManualStrategy() throws Exception {
NamedTopic<String> topic = coherence.getSession().getTopic("TwentyManual");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);
try (Publisher<String> publisher = topic.createPublisher()) {
// publish four messages
for (int i = 0; i < 4; i++) {
publisher.publish("element-" + i).get(1, TimeUnit.MINUTES);
}
// should receive four messages
Eventually.assertDeferred(() -> listenerSix.countManual.get(), is(4));
// fourth message should not be committed
assertThat(caches.isCommitted(groupId, listenerSix.element.getChannel(), listenerSix.element.getPosition()), is(false));
// publish a fifth message
publisher.publish("element-5").get(1, TimeUnit.MINUTES);
// should receive fifth messages
Eventually.assertDeferred(() -> listenerSix.countManual.get(), is(5));
// fifth message should not be committed
assertThat(caches.isCommitted(groupId, listenerSix.element.getChannel(), listenerSix.element.getPosition()), is(true));
}
}
use of com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId in project coherence-spring by coherence-community.
the class CoherenceTopicListenerTest method shouldCommitWithManualStrategy.
@Test
void shouldCommitWithManualStrategy() throws Exception {
NamedTopic<String> topic = this.coherence.getSession().getTopic("TwentyManual");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);
try (Publisher<String> publisher = topic.createPublisher()) {
// publish four messages
for (int i = 0; i < 4; i++) {
publisher.publish("element-" + i).get(1, TimeUnit.MINUTES);
}
// should receive four messages
Eventually.assertDeferred(() -> this.listenerSix.countManual.get(), is(4));
// fourth message should not be committed
assertThat(caches.isCommitted(groupId, this.listenerSix.element.getChannel(), this.listenerSix.element.getPosition()), is(false));
// publish a fifth message
publisher.publish("element-5").get(1, TimeUnit.MINUTES);
// should receive fifth messages
Eventually.assertDeferred(() -> this.listenerSix.countManual.get(), is(5));
// fifth message should not be committed
assertThat(caches.isCommitted(groupId, this.listenerSix.element.getChannel(), this.listenerSix.element.getPosition()), is(true));
}
}
Aggregations