@@ -70,7 +70,8 @@ object KafkaUtils {
70
70
topics : Map [String , Int ],
71
71
storageLevel : StorageLevel
72
72
): ReceiverInputDStream [(K , V )] = {
73
- new KafkaInputDStream [K , V , U , T ](ssc, kafkaParams, topics, false , storageLevel)
73
+ val WALEnabled = ssc.conf.getBoolean(" spark.streaming.receiver.writeAheadLog.enable" , false )
74
+ new KafkaInputDStream [K , V , U , T ](ssc, kafkaParams, topics, WALEnabled , storageLevel)
74
75
}
75
76
76
77
/**
@@ -143,121 +144,4 @@ object KafkaUtils {
143
144
createStream[K , V , U , T ](
144
145
jssc.ssc, kafkaParams.toMap, Map (topics.mapValues(_.intValue()).toSeq: _* ), storageLevel)
145
146
}
146
-
147
- /**
148
- * Create an reliable input stream that pulls messages from a Kafka Broker.
149
- * @param ssc StreamingContext object
150
- * @param zkQuorum Zookeeper quorum (hostname:port,hostname:port,..)
151
- * @param groupId The group id for this consumer
152
- * @param topics Map of (topic_name -> numPartitions) to consume. Each partition is consumed
153
- * in its own thread
154
- * @param storageLevel Storage level to use for storing the received objects
155
- * (default: StorageLevel.MEMORY_AND_DISK_SER_2)
156
- */
157
- def createReliableStream (
158
- ssc : StreamingContext ,
159
- zkQuorum : String ,
160
- groupId : String ,
161
- topics : Map [String , Int ],
162
- storageLevel : StorageLevel = StorageLevel .MEMORY_AND_DISK_SER_2 )
163
- : ReceiverInputDStream [(String , String )] = {
164
- val kafkaParams = Map [String , String ](
165
- " zookeeper.connect" -> zkQuorum, " group.id" -> groupId,
166
- " zookeeper.connection.timeout.ms" -> " 10000" )
167
- createReliableStream[String , String , StringDecoder , StringDecoder ](
168
- ssc, kafkaParams, topics, storageLevel)
169
- }
170
-
171
- /**
172
- * Create an reliable input stream that pulls messages from a Kafka Broker.
173
- * @param ssc StreamingContext object
174
- * @param kafkaParams Map of kafka configuration parameters,
175
- * see http://kafka.apache.org/08/configuration.html
176
- * @param topics Map of (topic_name -> numPartitions) to consume. Each partition is consumed
177
- * in its own thread.
178
- * @param storageLevel Storage level to use for storing the received objects
179
- */
180
- def createReliableStream [
181
- K : ClassTag ,
182
- V : ClassTag ,
183
- U <: Decoder [_]: ClassTag ,
184
- T <: Decoder [_]: ClassTag ](
185
- ssc : StreamingContext ,
186
- kafkaParams : Map [String , String ],
187
- topics : Map [String , Int ],
188
- storageLevel : StorageLevel
189
- ): ReceiverInputDStream [(K , V )] = {
190
- new KafkaInputDStream [K , V , U , T ](ssc, kafkaParams, topics, true , storageLevel)
191
- }
192
-
193
- /**
194
- * Create an reliable Java input stream that pulls messages form a Kafka Broker.
195
- * Storage level of the data will be the default StorageLevel.MEMORY_AND_DISK_SER_2.
196
- * @param jssc JavaStreamingContext object
197
- * @param zkQuorum Zookeeper quorum (hostname:port,hostname:port,..)
198
- * @param groupId The group id for this consumer
199
- * @param topics Map of (topic_name -> numPartitions) to consume. Each partition is consumed
200
- * in its own thread
201
- */
202
- def createReliableStream (
203
- jssc : JavaStreamingContext ,
204
- zkQuorum : String ,
205
- groupId : String ,
206
- topics : JMap [String , JInt ]
207
- ): JavaPairReceiverInputDStream [String , String ] = {
208
- createReliableStream(jssc.ssc, zkQuorum, groupId, Map (topics.mapValues(_.intValue()).toSeq: _* ))
209
- }
210
-
211
- /**
212
- * Create an reliable Java input stream that pulls messages form a Kafka Broker.
213
- * @param jssc JavaStreamingContext object
214
- * @param zkQuorum Zookeeper quorum (hostname:port,hostname:port,..).
215
- * @param groupId The group id for this consumer.
216
- * @param topics Map of (topic_name -> numPartitions) to consume. Each partition is consumed
217
- * in its own thread.
218
- * @param storageLevel RDD storage level.
219
- */
220
- def createReliableStream (
221
- jssc : JavaStreamingContext ,
222
- zkQuorum : String ,
223
- groupId : String ,
224
- topics : JMap [String , JInt ],
225
- storageLevel : StorageLevel
226
- ): JavaPairReceiverInputDStream [String , String ] = {
227
- createReliableStream(jssc.ssc, zkQuorum, groupId, Map (topics.mapValues(_.intValue()).toSeq: _* ),
228
- storageLevel)
229
- }
230
-
231
- /**
232
- * Create an reliable Java input stream that pulls messages form a Kafka Broker.
233
- * @param jssc JavaStreamingContext object
234
- * @param keyTypeClass Key type of RDD
235
- * @param valueTypeClass value type of RDD
236
- * @param keyDecoderClass Type of kafka key decoder
237
- * @param valueDecoderClass Type of kafka value decoder
238
- * @param kafkaParams Map of kafka configuration parameters,
239
- * see http://kafka.apache.org/08/configuration.html
240
- * @param topics Map of (topic_name -> numPartitions) to consume. Each partition is consumed
241
- * in its own thread
242
- * @param storageLevel RDD storage level.
243
- */
244
- def createReliableStream [K , V , U <: Decoder [_], T <: Decoder [_]](
245
- jssc : JavaStreamingContext ,
246
- keyTypeClass : Class [K ],
247
- valueTypeClass : Class [V ],
248
- keyDecoderClass : Class [U ],
249
- valueDecoderClass : Class [T ],
250
- kafkaParams : JMap [String , String ],
251
- topics : JMap [String , JInt ],
252
- storageLevel : StorageLevel
253
- ): JavaPairReceiverInputDStream [K , V ] = {
254
- implicit val keyCmt : ClassTag [K ] = ClassTag (keyTypeClass)
255
- implicit val valueCmt : ClassTag [V ] = ClassTag (valueTypeClass)
256
-
257
- implicit val keyCmd : ClassTag [U ] = ClassTag (keyDecoderClass)
258
- implicit val valueCmd : ClassTag [T ] = ClassTag (valueDecoderClass)
259
-
260
- createReliableStream[K , V , U , T ](
261
- jssc.ssc, kafkaParams.toMap, Map (topics.mapValues(_.intValue()).toSeq: _* ), storageLevel)
262
- }
263
147
}
0 commit comments