Please see examples at
Bean Shell Programming Guide | Use as Process Participant