-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
frank.yao
committed
Nov 7, 2013
1 parent
c028c24
commit e59cd32
Showing
9 changed files
with
133 additions
and
132 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/com/vipshop/flume/config/KafkaSinkConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.vipshop.flume.config; | ||
|
||
import org.apache.flume.Context; | ||
|
||
public class KafkaSinkConfig { | ||
public static String getProducerType(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_PRODUCER_TYPE, "sync"); | ||
} | ||
public static String getBrokerList(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_BROKER_LIST, null); | ||
} | ||
public static String getZkConnect(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_ZK_CONNECT, null); | ||
} | ||
public static String getBufferSize(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_BUFFER_SIZE, "102400"); | ||
} | ||
public static String getConnectTimeoutMs(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_CONNECT_TIMEOUT_MS, "5000"); | ||
} | ||
public static String getSocketTimeoutMs(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_SOCKET_TIMEOUT_MS, "30000"); | ||
} | ||
public static String getReconnectInterval(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_RECONNECT_INTERVAL, "30000"); | ||
} | ||
public static String getReconnectTimeIntervalMs(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_RECONNECT_TIME_INTERVAL_MS, "10000000"); // 10*1000*1000 | ||
} | ||
public static String getMaxMessageSize(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_MAX_MESSAGE_SIZE, "1000000"); | ||
} | ||
public static String getCompressionCodec(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_COMPRESSION_CODEC, "0"); | ||
} | ||
public static String getCompressedTopics(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_COMPRESSED_TOPICS, null); | ||
} | ||
public static String getZkReadNumRetries(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_ZK_READ_NUM_RETRIES, "3"); | ||
} | ||
// For Async | ||
public static String getQueueTime(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_QUEUE_TIME, "5000"); | ||
} | ||
public static String getQueueSize(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_QUEUE_SIZE, "10000"); | ||
} | ||
public static String getBatchSize(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_BATCH_SIZE, "200"); | ||
} | ||
public static String getTopic(Context context) { | ||
return context.getString(KafkaSinkConstants.CONFIG_TOPIC); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/com/vipshop/flume/config/KafkaSourceConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.vipshop.flume.config; | ||
|
||
import org.apache.flume.Context; | ||
|
||
public class KafkaSourceConfig { | ||
public static String getGroupId(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_GROUPID, "groupid"); | ||
} | ||
public static String getSocketTimeoutMs(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_SOCKET_TIMEOUT_MS, "30000"); | ||
} | ||
public static String getSocketBufferSize(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_SOCKET_BUFFER_SIZE, "65536"); // 64*1024 | ||
} | ||
public static String getFetchSize(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_FETCH_SIZE, "307200"); // 300*1024 | ||
} | ||
public static String getBackOffIncrementMs(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_BACKOFF_INCREMENT_MS, "1000"); | ||
} | ||
public static String getQueuedChunksMax(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_QUEUEDCHUNKS_MAX, "100"); | ||
} | ||
public static String getAutoCommitEnable(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_AUTOCOMMIT_ENABLE, "true"); | ||
} | ||
public static String getAutoCommitIntervalMs(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_AUTOCOMMIT_INTERVAL_MS, "10000"); | ||
} | ||
public static String getAutoOffsetReset(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_AUTOOFFSET_RESET, "smallest"); | ||
} | ||
public static String getConsumerTimeoutMs(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_CONSUMER_TIMEOUT_MS, "-1"); | ||
} | ||
public static String getRebalanceRetriesMax(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_REBALANCE_RETRIES_MAX, "4"); | ||
} | ||
public static String getMirrorTopicsWhiteList(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_MIRROR_TOPICS_WHITELIST, ""); | ||
} | ||
public static String getMirrorTopicsBlackList(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_MIRROR_TOPICS_BLACKLIST, ""); | ||
} | ||
public static String getMirrorConsumerNumThreads(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_MIRROR_CONSUMER_NUMTHREADS, "4"); | ||
} | ||
public static String getBrokerList(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_BROKER_LIST, null); | ||
} | ||
public static String getZkConnect(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_ZK_CONNECT, null); | ||
} | ||
public static String getTopic(Context context) { | ||
return context.getString(KafkaSourceConstants.CONFIG_TOPIC); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters