public static void unwindMessages ( final Object message , final List < Object > messages ) { if ( message instanceof Iterable ) { @ SuppressWarnings ( "rawtypes" ) final Iterator it = ( ( Iterable ) message ) . iterator ( ) ; while ( it . hasNext ( ) ) unwindMessages ( it . next ( ) , messages ) ; } else messages . add ( message ) ; }
Return values from invoke s may be Iterables in which case there are many messages to be sent out .