private void handleTaskMigrated(final TaskMigratedException e) {
        log.warn("Detected that the thread is being fenced. " +
                     "This implies that this thread missed a rebalance and dropped out of the consumer group. " +
                     "Will close out all assigned tasks and rejoin the consumer group.", e);

        taskManager.handleLostAll();
        mainConsumer.unsubscribe();
        subscribeConsumer();
    }
Sets the streams uncaught exception handler.

@param streamsUncaughtExceptionHandler the user handler wrapped in shell to execute the action
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java