org.springframework.batch.integration.chunk
Class ChunkProcessorChunkHandler<S>

java.lang.Object
  extended by org.springframework.batch.integration.chunk.ChunkProcessorChunkHandler<S>
Type Parameters:
S - the type of the items in the chunk to be handled
All Implemented Interfaces:
ChunkHandler<S>, InitializingBean

@MessageEndpoint
public class ChunkProcessorChunkHandler<S>
extends Object
implements ChunkHandler<S>, InitializingBean

A ChunkHandler based on a ChunkProcessor. Knows how to distinguish between a processor that is fault tolerant, and one that is not. If the processor is fault tolerant then exceptions can be propagated on the assumption that there will be a roll back and the request will be re-delivered.

Author:
Dave Syer

Constructor Summary
ChunkProcessorChunkHandler()
           
 
Method Summary
 void afterPropertiesSet()
           
 ChunkResponse handleChunk(ChunkRequest<S> chunkRequest)
          Handle the chunk, processing all the items and returning a response summarising the result.
 void setChunkProcessor(ChunkProcessor<S> chunkProcessor)
          Public setter for the ChunkProcessor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkProcessorChunkHandler

public ChunkProcessorChunkHandler()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

setChunkProcessor

public void setChunkProcessor(ChunkProcessor<S> chunkProcessor)
Public setter for the ChunkProcessor.

Parameters:
chunkProcessor - the chunkProcessor to set

handleChunk

@ServiceActivator
public ChunkResponse handleChunk(ChunkRequest<S> chunkRequest)
                          throws Exception
Description copied from interface: ChunkHandler
Handle the chunk, processing all the items and returning a response summarising the result. If the result is a failure then the response should say so. The handler only throws an exception if it needs to roll back a transaction and knows that the request will be re-delivered (if not to the same handler then to one processing the same Step).

Specified by:
handleChunk in interface ChunkHandler<S>
Parameters:
chunkRequest - a request containing the chunk to process
Returns:
a response summarising the result
Throws:
Exception - if the handler needs to roll back a transaction and have the chunk re-delivered
See Also:
ChunkHandler.handleChunk(ChunkRequest)


Copyright © 2011. All Rights Reserved.