Search in sources :

Example 21 with SubscriptionCursorWithoutToken

use of org.zalando.nakadi.view.SubscriptionCursorWithoutToken in project nakadi by zalando.

the class StreamingState method addToStreaming.

private void addToStreaming(final Partition partition, final Map<EventTypePartition, SubscriptionCursorWithoutToken> cursorMap) {
    final NakadiCursor cursor = createNakadiCursor(cursorMap.get(partition.getKey()));
    getLog().info("Adding to streaming {} with start position {}", partition.getKey(), cursor);
    final ZkSubscription<SubscriptionCursorWithoutToken> subscription = getZk().subscribeForOffsetChanges(partition.getKey(), () -> addTask(() -> offsetChanged(partition.getKey())));
    final PartitionData pd = new PartitionData(getComparator(), subscription, cursor, LoggerFactory.getLogger("subscription." + getSessionId() + "." + partition.getKey()), System.currentTimeMillis());
    offsets.put(partition.getKey(), pd);
}
Also used : SubscriptionCursorWithoutToken(org.zalando.nakadi.view.SubscriptionCursorWithoutToken) NakadiCursor(org.zalando.nakadi.domain.NakadiCursor)

Aggregations

SubscriptionCursorWithoutToken (org.zalando.nakadi.view.SubscriptionCursorWithoutToken)21 Test (org.junit.Test)12 NakadiCursor (org.zalando.nakadi.domain.NakadiCursor)9 EventTypePartition (org.zalando.nakadi.domain.EventTypePartition)8 Subscription (org.zalando.nakadi.domain.Subscription)5 Partition (org.zalando.nakadi.service.subscription.model.Partition)5 List (java.util.List)4 Map (java.util.Map)4 PartitionStatistics (org.zalando.nakadi.domain.PartitionStatistics)4 TopicRepository (org.zalando.nakadi.repository.TopicRepository)4 ImmutableList (com.google.common.collect.ImmutableList)3 HashMap (java.util.HashMap)3 Storage (org.zalando.nakadi.domain.Storage)3 InvalidCursorException (org.zalando.nakadi.exceptions.InvalidCursorException)3 ServiceUnavailableException (org.zalando.nakadi.exceptions.ServiceUnavailableException)3 NakadiTestUtils.createSubscription (org.zalando.nakadi.webservice.utils.NakadiTestUtils.createSubscription)3 UTF_8 (com.google.common.base.Charsets.UTF_8)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2