import java.time.Duration;
import java.util.Arrays;
+import java.util.concurrent.Callable;
@Slf4j
@RequiredArgsConstructor
-public class SimpleConsumer implements Runnable
+public class SimpleConsumer implements Callable<Integer>
{
private final String id;
private final String topic;
@Override
- public void run()
+ public Integer call()
{
try
{
catch(WakeupException e)
{
log.info("{} - Consumer was signaled to finish its work", id);
+ return 0;
}
catch(Exception e)
{
log.error("{} - Unexpected error: {}, unsubscribing!", id, e.toString());
consumer.unsubscribe();
+ return 1;
}
finally
{