public class JmsItemReader<T> extends java.lang.Object implements ItemReader<T>, org.springframework.beans.factory.InitializingBean
ItemReader for JMS using a JmsTemplate. The template
should have a default destination, which will be used to provide items in
read().| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Class<? extends T> |
itemType |
protected org.springframework.jms.core.JmsOperations |
jmsTemplate |
protected org.apache.commons.logging.Log |
logger |
| Constructor and Description |
|---|
JmsItemReader() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
T |
read()
Reads a piece of input data and advance to the next one.
|
void |
setItemType(java.lang.Class<? extends T> itemType)
Set the expected type of incoming message payloads.
|
void |
setJmsTemplate(org.springframework.jms.core.JmsOperations jmsTemplate)
Setter for JMS template.
|
protected org.apache.commons.logging.Log logger
protected java.lang.Class<? extends T> itemType
protected org.springframework.jms.core.JmsOperations jmsTemplate
public void setJmsTemplate(org.springframework.jms.core.JmsOperations jmsTemplate)
jmsTemplate - a JmsOperations instancepublic void setItemType(java.lang.Class<? extends T> itemType)
Message to receive the raw underlying message.itemType - the java class of the items to be delivered. Typically
the same as the class parameterjava.lang.IllegalStateException - if the message payload is of the wrong
type.public T 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<T>public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exception