Package org.springframework.cloud.task.batch.listener

# Class EventEmittingItemWriteListener

java.lang.Object
org.springframework.cloud.task.batch.listener.EventEmittingItemWriteListener

All Implemented Interfaces:
  `org.springframework.batch.core.ItemWriteListener`, `org.springframework.batch.core.StepListener`, `org.springframework.core.Ordered`

public class EventEmittingItemWriteListener extends Object implements org.springframework.batch.core.ItemWriteListener, org.springframework.core.Ordered
Setups up the ItemWriteEventsListener to emit events to the spring cloud stream output channel. Each method provides an informational message. `ItemWriteListener.onWriteError(Exception, List)` provides a message as well as the exception's message via the `BatchJobHeaders.BATCH_EXCEPTION` message header.

Author:
  Glenn Renfro, Ali Shahbour

- ## Field Summary

  ### Fields inherited from interface org.springframework.core.Ordered

  `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EventEmittingItemWriteListener(MessagePublisher messagePublisher, int order, TaskEventProperties properties)`
  `EventEmittingItemWriteListener(MessagePublisher messagePublisher, TaskEventProperties properties)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterWrite(List items)`
  `void`
  `beforeWrite(List items)`
  `int`
  `getOrder()`
  `void`
  `onWriteError(Exception exception, List items)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### EventEmittingItemWriteListener

    public EventEmittingItemWriteListener(MessagePublisher messagePublisher, TaskEventProperties properties)

  - ### EventEmittingItemWriteListener

    public EventEmittingItemWriteListener(MessagePublisher messagePublisher, int order, TaskEventProperties properties)

- ## Method Details

  - ### beforeWrite

    public void beforeWrite(List items)
    Specified by:
      `beforeWrite` in interface `org.springframework.batch.core.ItemWriteListener`

  - ### afterWrite

    public void afterWrite(List items)
    Specified by:
      `afterWrite` in interface `org.springframework.batch.core.ItemWriteListener`

  - ### onWriteError

    public void onWriteError(Exception exception, List items)
    Specified by:
      `onWriteError` in interface `org.springframework.batch.core.ItemWriteListener`

  - ### getOrder

    public int getOrder()
    Specified by:
      `getOrder` in interface `org.springframework.core.Ordered`