Use a Java main class as consumer