@@ -0,0 +1,1211 @@
+package org.easybatch.core.util;%0A%0Aimport org.easybatch.core.api.RecordDispatcher;%0Aimport org.easybatch.core.api.event.global.BatchProcessEventListener;%0Aimport org.easybatch.core.record.PoisonRecord;%0A%0A/**%0A * A utility batch event listener that broadcasts a poison record at the end of batch%0A * using a delegate %7B@link RecordDispatcher%7D.%0A *%0A * @author Mahmoud Ben Hassine (mahmoud@benhassine.fr)%0A */%0Apublic class PoisonRecordBroadcaster implements BatchProcessEventListener %7B%0A%0A    private RecordDispatcher recordDispatcher;%0A%0A    /**%0A     * Create a new %7B@link PoisonRecordBroadcaster%7D.%0A     * @param recordDispatcher the delegate %7B@link RecordDispatcher%7D used to dispatch the poison record%0A     */%0A    public PoisonRecordBroadcaster(RecordDispatcher recordDispatcher) %7B%0A        this.recordDispatcher = recordDispatcher;%0A    %7D%0A%0A    @Override%0A    public void beforeBatchStart() %7B%0A%0A    %7D%0A%0A    @Override%0A    public void afterBatchEnd() %7B%0A        try %7B%0A            recordDispatcher.dispatchRecord(new PoisonRecord());%0A        %7D catch (Exception e) %7B%0A            throw new RuntimeException(%22Unable to broadcast poison record%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void onException(Throwable throwable) %7B%0A%0A    %7D%0A%7D%0A

add a convenient BatchProcessEventListener to broadcast a poison record at the end of batch execution