Database Reference
In-Depth Information
List<Object>
interface and provides convenience constructors to make it
easy to produce new Tuple objects.
Finally, the tuple is acknowledged via
ack(input)
. This tells Storm that
the tuple has been handled, which is important when the bolt is being
used in a transactional fashion. If the processing of the tuple fails for some
reason, the bolt may use
fail(input)
instead of
ack(input)
to report
this fact.
The collector object also has a
reportError
method, which can be used to
report on non-fatal exceptions in the flow. This method takes a
Throwable
object, and the message from the exception is reflected in the Storm UI. For
example, a bolt that handles URLs can report on parsing errors:
public void
execute(Tuple input) {
try
{
URL url =
new
URL(input.getString(0));
collector.emit(
new
Values(url.getAuthority(),
url.getHost(),
url.getPath()));
}
catch
(MalformedURLException e) {
collector.reportError(e);
collector.fail(input);
}
}