Check that everything coming in on the EventSpout is Serializable before sending it out so the Spout doesn't die.
This commit is contained in:
parent
0aad1652d1
commit
6deb113700
@ -1,5 +1,6 @@
|
||||
package com.hpcloud.mon.infrastructure.thresholding;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@ -35,7 +36,12 @@ public class EventSpout extends KafkaSpout {
|
||||
List<List<?>> events = deserializer.deserialize(message);
|
||||
if (events != null) {
|
||||
for (final List<?> event : events) {
|
||||
collector.emit(new Values(event.get(0)));
|
||||
final Object eventToSend = event.get(0);
|
||||
if (!(eventToSend instanceof Serializable)) {
|
||||
LOG.error("Class {} is not Serializable: {}", eventToSend.getClass(), eventToSend);
|
||||
continue;
|
||||
}
|
||||
collector.emit(new Values(eventToSend));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user