Advertisement
Guest User

Untitled

a guest
May 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. package io.enfuse.kafka.connect.connector.config;
  2.  
  3. import java.util.Map;
  4. import org.apache.kafka.common.config.AbstractConfig;
  5. import org.apache.kafka.common.config.ConfigDef;
  6.  
  7. public class RandomLongSourceConnectorConfig extends AbstractConfig {
  8.  
  9. public static final String API_URL_CONFIG = "api.url";
  10. private static final String API_ENDPOINT_DOC = "API URL";
  11.  
  12. public static final String TOPIC_CONFIG = "topic";
  13. private static final String TOPIC_DOC = "Topic to write to";
  14.  
  15. public static final String SLEEP_CONFIG = "sleep.seconds";
  16. private static final String SLEEP_DOC = "Time in seconds that connector will wait until querying api again";
  17.  
  18. private final String url;
  19. private final String topic;
  20. private final int sleepInSeconds;
  21.  
  22. public RandomLongSourceConnectorConfig(Map<?, ?> originals) {
  23. super(config(), originals);
  24. this.url = getString(API_URL_CONFIG);
  25. this.topic = getString(TOPIC_CONFIG);
  26. this.sleepInSeconds = getInt(SLEEP_CONFIG);
  27. }
  28.  
  29. public static ConfigDef config() {
  30. return new ConfigDef()
  31. .define(API_URL_CONFIG, ConfigDef.Type.STRING, ConfigDef.Importance.HIGH, API_ENDPOINT_DOC)
  32. .define(TOPIC_CONFIG, ConfigDef.Type.STRING, ConfigDef.Importance.HIGH, TOPIC_DOC)
  33. .define(SLEEP_CONFIG, ConfigDef.Type.INT, 60, ConfigDef.Importance.MEDIUM, SLEEP_DOC);
  34. }
  35.  
  36. public String getUrl() {
  37. return url;
  38. }
  39.  
  40. public String getTopic() {
  41. return topic;
  42. }
  43.  
  44. public int getSleepInSeconds() {
  45. return sleepInSeconds;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement