Search in sources :

Example 1 with ReliableFailHandler

use of nl.minvenj.nfi.storm.kafka.fail.ReliableFailHandler in project kafka-spout by HolmesNL.

the class KafkaSpoutFailurePolicyTest method testReliableFailure.

@Test
public void testReliableFailure() {
    final FailHandler reliable = spy(new ReliableFailHandler());
    _subject._failHandler = reliable;
    final KafkaMessageId id = new KafkaMessageId(1, 1234);
    final byte[] message = { 1, 2, 3, 4 };
    _subject._inProgress.put(id, message);
    // fail the message
    _subject.fail(id);
    // verify decision delegate to fail handler and replay
    verify(reliable).shouldReplay(eq(id));
    assertEquals(id, _subject._queue.peek());
    assertTrue(_subject._inProgress.containsKey(id));
}
Also used : KafkaMessageId(nl.minvenj.nfi.storm.kafka.util.KafkaMessageId) ReliableFailHandler(nl.minvenj.nfi.storm.kafka.fail.ReliableFailHandler) FailHandler(nl.minvenj.nfi.storm.kafka.fail.FailHandler) ReliableFailHandler(nl.minvenj.nfi.storm.kafka.fail.ReliableFailHandler) UnreliableFailHandler(nl.minvenj.nfi.storm.kafka.fail.UnreliableFailHandler) Test(org.junit.Test)

Aggregations

FailHandler (nl.minvenj.nfi.storm.kafka.fail.FailHandler)1 ReliableFailHandler (nl.minvenj.nfi.storm.kafka.fail.ReliableFailHandler)1 UnreliableFailHandler (nl.minvenj.nfi.storm.kafka.fail.UnreliableFailHandler)1 KafkaMessageId (nl.minvenj.nfi.storm.kafka.util.KafkaMessageId)1 Test (org.junit.Test)1