org.springframework.integration.jpa.inbound
Class JpaPollingChannelAdapter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.jpa.inbound.JpaPollingChannelAdapter
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, NamedComponent, MessageSource<java.lang.Object>
public class JpaPollingChannelAdapter
- extends IntegrationObjectSupport
- implements MessageSource<java.lang.Object>
Polling message source that produces messages from the result of the provided:
- entityClass
- JpQl Select Query
- Sql Native Query
- JpQl Named Query
- Sql Native Named Query
After the objects have been polled, it also possibly to either:
executes an update after the select possibly to updated the state of selected records
- executes an update (per retrieved object or for the entire payload)
- delete the retrieved object
- Since:
- 2.2
- Author:
- Amol Nayak, Gunnar Hillert
Method Summary |
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information. |
protected void |
onInit()
Check for mandatory attributes |
Message<java.lang.Object> |
receive()
Uses JpaExecutor.poll() to executes the JPA operation. |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
JpaPollingChannelAdapter
public JpaPollingChannelAdapter(JpaExecutor jpaExecutor)
- Constructor taking a
JpaExecutor
that provide all required JPA
functionality.
- Parameters:
jpaExecutor
- Must not be null.
onInit
protected void onInit()
throws java.lang.Exception
- Check for mandatory attributes
- Overrides:
onInit
in class IntegrationObjectSupport
- Throws:
java.lang.Exception
receive
public Message<java.lang.Object> receive()
- Uses
JpaExecutor.poll()
to executes the JPA operation.
If JpaExecutor.poll()
returns null, this method will return
null
. Otherwise, a new Message
is constructed and returned.
- Specified by:
receive
in interface MessageSource<java.lang.Object>
getComponentType
public java.lang.String getComponentType()
- Description copied from class:
IntegrationObjectSupport
- Subclasses may implement this method to provide component type information.
- Specified by:
getComponentType
in interface NamedComponent
- Overrides:
getComponentType
in class IntegrationObjectSupport