Databases Reference
In-Depth Information
}
// If the number of failures is less than the maximum, save the number and re-send
the message
transactionFailureCount . put ( transactionId , failures );
toSend . put ( transactionId , messages . get ( transactionId ));
LOG . info ( "Re-sending message [" + msgId + "]" );
}
First, check the number of times the transaction has failed. If a transaction fails too
many times, throw a RuntimeException to terminate the worker where it is running.
Otherwise, save the failure count and put the transaction message in the toSend queue
so that it will be resent when nextTuple is called.
Storm nodes do not maintain state, so if you store information in mem-
ory (as in this example) and the node goes down, you will lose all stored
information.
Storm is a fast-fail system. If an exception is thrown, the topology will go down, but
Storm will restart the process in a consistent state so that it can recover correctly.
Getting Data
Here you'll take a look at some common techniques for designing spouts that collect
data efficiently from multiple sources.
Direct Connection
In a direct connection architecture, the spout connects directly to a message emitter
(see Figure 4-1 ).
Figure 4-1. Direct connection spout
This architecture is simple to implement, particularly when the message emitter is a
well-known device or a well-known device group. A well-known device is one that is
known at startup and remains the same throughout the life of the topology. An
 
Search WWH ::




Custom Search