|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.item.AbstractItemReader
org.springframework.batch.item.jms.JmsItemReader
public class JmsItemReader
An ItemReader for JMS using a JmsTemplate. The template
should have a default destination, which will be used to provide items in
read(). If a recovery step is needed, set the error destination and
the item will be sent there if processing fails in an external retry.
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
|---|---|
JmsItemReader()
|
|
| Method Summary | |
|---|---|
Object |
getKey(Object item)
If the message is a Message then returns the JMS message ID. |
boolean |
hasFailed(Object item)
If the item is a message, check the JMS redelivered flag, otherwise return true to be on the safe side. |
Object |
read()
Reads a piece of input data and advance to the next one. |
boolean |
recover(Object item,
Throwable cause)
Send the message back to the proovider using the specified error destination property of this provider. |
void |
setErrorDestination(Destination errorDestination)
Set the error destination. |
void |
setErrorDestinationName(String errorDestinationName)
Set the error destination by name. |
void |
setItemType(Class itemType)
Set the expected type of incoming message payloads. |
void |
setJmsTemplate(JmsOperations jmsTemplate)
Setter for jms template. |
| Methods inherited from class org.springframework.batch.item.AbstractItemReader |
|---|
mark, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public JmsItemReader()
| Method Detail |
|---|
public void setErrorDestination(Destination errorDestination)
errorDestination - a JMS Destinationpublic void setErrorDestinationName(String errorDestinationName)
errorDestinationName - the name of a JMS Destinationpublic void setJmsTemplate(JmsOperations jmsTemplate)
jmsTemplate - a JmsOperations instancepublic void setItemType(Class itemType)
Message to receive the raw underlying message.
itemType - the java class of the items to be delivered.
IllegalStateException - if the message payload is of the wrong
type.public Object read()
ItemReadernull at the end of the input
data set. In a transactional setting, caller might get the same item
twice from successive calls (or otherwise), if the first call was in a
transaction that rolled back.
read in interface ItemReader
public boolean recover(Object item,
Throwable cause)
recover in interface ItemRecovereritem - the item that failed.cause - the cause of the failure that led to this recovery.
ItemRecoverer.recover(Object,
Throwable)public Object getKey(Object item)
Message then returns the JMS message ID.
Otherwise just delegate to parent class.
getKey in interface ItemKeyGeneratoritem - the current item.
UnexpectedInputException - if the JMS id cannot be determined from
a JMS MessageItemKeyGenerator.getKey(java.lang.Object)public boolean hasFailed(Object item)
hasFailed in interface FailedItemIdentifieritem - the current item.
FailedItemIdentifier.hasFailed(java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||