{
11 |
12 | @Override
13 | public String extract(Job input) {
14 | return input.getUrl();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/org/aravind/oss/kafka/connect/jenkins/ReadYourWritesOffsetStorageAdapter.java:
--------------------------------------------------------------------------------
1 | package org.aravind.oss.kafka.connect.jenkins;
2 |
3 | import org.apache.kafka.connect.storage.OffsetStorageReader;
4 | import org.aravind.oss.kafka.connect.lib.SourceOffset;
5 | import org.aravind.oss.kafka.connect.lib.Partitions;
6 | import org.aravind.oss.kafka.connect.lib.SourcePartition;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 |
10 | import java.util.*;
11 |
12 | import static org.aravind.oss.kafka.connect.jenkins.Util.*;
13 |
14 | /**
15 | * Sources cache the offsets and periodically flush(or commit) them asynchronously. The following two properties
16 | * are used to control this behavior.
17 | *
18 | *
19 | * - offset.flush.timeout.ms = 5000
20 | * - offset.flush.interval.ms = 1000
21 | *
22 | *
23 | * Currently the {@link org.apache.kafka.connect.storage.OffsetStorageReader} only reads the offsets that
24 | * have been flushed. The cached offsets are not returned. However, the read-your-writes consistency
25 | * model is needed to simplify source connector development.
26 | *
27 | *
28 | * Read-your-writes consistency: A value written by a process on a data item X will be always available to a
29 | * successive read operation performed by the same process on data item X.
30 | *
31 | *
32 | * This class provides the Read-your-Writes semantics within a single {@link org.apache.kafka.connect.source.SourceTask}
33 | *
34 | * @author Aravind R Yarram
35 | * @since 0.5.0
36 | */
37 | public class ReadYourWritesOffsetStorageAdapter {
38 |
39 | private OffsetStorageReader storageReader;
40 |
41 | private final Partitions partitions;
42 |
43 | //task level cache
44 | private Map