Class AmqpItemWriter<T>

java.lang.Object
org.springframework.batch.infrastructure.item.amqp.AmqpItemWriter<T>
All Implemented Interfaces:
ItemWriter<T>

public class AmqpItemWriter<T> extends Object implements ItemWriter<T>

AMQP ItemWriter implementation using an AmqpTemplate to send messages. Messages will be sent to the nameless exchange if not specified on the provided AmqpTemplate.

This writer is thread-safe as long as the delegate AmqpTemplate implementation is thread-safe.

Author:
Chris Schaefer, Mahmoud Ben Hassine
  • Constructor Details

    • AmqpItemWriter

      public AmqpItemWriter(org.springframework.amqp.core.AmqpTemplate amqpTemplate)
  • Method Details

    • write

      public void write(Chunk<? extends T> items) throws Exception
      Description copied from interface: ItemWriter
      Process the supplied data element. Will not be called with any null items in normal operation but might be called with an empty chunk, for example when all items have been filtered by an ItemProcessor or skipped by the fault-tolerant step processing. Implementations are expected to handle empty chunks gracefully.
      Specified by:
      write in interface ItemWriter<T>
      Parameters:
      items - of items to be written. Never null but may be empty.
      Throws:
      Exception - if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.