org.apache.flume.sink.kite.policy

## Interface FailurePolicy

- All Known Implementing Classes:
    RetryPolicy, SavePolicy

      public interface FailurePolicy

  A policy for dealing with non-recoverable event delivery failures. Non-recoverable event delivery failures include: 1. Error parsing the event body thrown from the `EntityParser` 2. A schema mismatch between the schema of an event and the schema of the destination dataset. 3. A missing schema from the Event header when using the `AvroEntityParser`. The life cycle of a FailurePolicy mimics the life cycle of the `DatasetSink.writer`: 1. When a new writer is created, the policy will be instantiated. 2. As Event failures happen, `handle(org.apache.flume.Event, java.lang.Throwable)` will be called to let the policy handle the failure. 3. If the `DatasetSink` is configured to commit on batch, then the `sync()` method will be called when the batch is committed. 4. When the writer is closed, the policy's `close()` method will be called.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `FailurePolicy.Builder` Knows how to build `FailurePolicy`s.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close this FailurePolicy and release any resources.
    `void` | `handle(Event event, Throwable cause)` Handle a non-recoverable event.
    `void` | `sync()` Ensure any handled events are on stable storage.

- - ### Method Detail

    - #### handle

          void handle(Event event,
                    Throwable cause)
                      throws EventDeliveryException

      Handle a non-recoverable event.
      Parameters:
        `event` - The event
        `cause` - The cause of the failure
      Throws:
        `EventDeliveryException` - The policy failed to handle the event. When this is thrown, the Flume transaction will be rolled back and the event will be retried along with the rest of the batch.

    - #### sync

          void sync()
                    throws EventDeliveryException

      Ensure any handled events are on stable storage. This allows the policy implementation to sync any data that it may not have fully handled. See `Syncable.sync()`.
      Throws:
        `EventDeliveryException` - The policy failed while syncing data. When this is thrown, the Flume transaction will be rolled back and the batch will be retried.

    - #### close

          void close()
                     throws EventDeliveryException

      Close this FailurePolicy and release any resources.
      Throws:
        `EventDeliveryException` - The policy failed while closing resources. When this is thrown, the Flume transaction will be rolled back and the batch will be retried.

Copyright © 2009-2016 Apache Software Foundation. All Rights Reserved.