org.apache.camel.component.jpa
Class JpaConsumer
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultConsumer
org.apache.camel.impl.ScheduledPollConsumer
org.apache.camel.component.jpa.JpaConsumer
- All Implemented Interfaces:
- Runnable, org.apache.camel.BatchConsumer, org.apache.camel.Consumer, org.apache.camel.PollingConsumerPollingStrategy, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.ShutdownAware, org.apache.camel.SuspendableService
public class JpaConsumer
- extends org.apache.camel.impl.ScheduledPollConsumer
- implements org.apache.camel.BatchConsumer, org.apache.camel.spi.ShutdownAware
- Version:
| Fields inherited from class org.apache.camel.impl.DefaultConsumer |
log |
| Methods inherited from class org.apache.camel.impl.ScheduledPollConsumer |
afterPoll, beforePoll, doStart, doStop, doSuspend, getDelay, getInitialDelay, getPollStrategy, getRunLoggingLevel, getTimeUnit, isPollAllowed, isUseFixedDelay, onInit, run, setDelay, setInitialDelay, setPollStrategy, setRunLoggingLevel, setTimeUnit, setUseFixedDelay |
| Methods inherited from class org.apache.camel.impl.DefaultConsumer |
getAsyncProcessor, getExceptionHandler, getProcessor, handleException, setExceptionHandler, toString |
| Methods inherited from class org.apache.camel.impl.ServiceSupport |
addChildService, doResume, doShutdown, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend |
| Methods inherited from interface org.apache.camel.Service |
start, stop |
| Methods inherited from interface org.apache.camel.SuspendableService |
isSuspended, resume, suspend |
JpaConsumer
public JpaConsumer(JpaEndpoint endpoint,
org.apache.camel.Processor processor)
poll
protected int poll()
throws Exception
- Specified by:
poll in class org.apache.camel.impl.ScheduledPollConsumer
- Throws:
Exception
setMaxMessagesPerPoll
public void setMaxMessagesPerPoll(int maxMessagesPerPoll)
- Specified by:
setMaxMessagesPerPoll in interface org.apache.camel.BatchConsumer
processBatch
public int processBatch(Queue<Object> exchanges)
throws Exception
- Specified by:
processBatch in interface org.apache.camel.BatchConsumer
- Throws:
Exception
deferShutdown
public boolean deferShutdown(org.apache.camel.ShutdownRunningTask shutdownRunningTask)
- Specified by:
deferShutdown in interface org.apache.camel.spi.ShutdownAware
getPendingExchangesSize
public int getPendingExchangesSize()
- Specified by:
getPendingExchangesSize in interface org.apache.camel.spi.ShutdownAware
prepareShutdown
public void prepareShutdown()
- Specified by:
prepareShutdown in interface org.apache.camel.spi.ShutdownAware
isBatchAllowed
public boolean isBatchAllowed()
- Specified by:
isBatchAllowed in interface org.apache.camel.BatchConsumer
getEndpoint
public JpaEndpoint getEndpoint()
- Specified by:
getEndpoint in interface org.apache.camel.Consumer- Overrides:
getEndpoint in class org.apache.camel.impl.DefaultConsumer
getQueryFactory
public QueryFactory getQueryFactory()
setQueryFactory
public void setQueryFactory(QueryFactory queryFactory)
getDeleteHandler
public DeleteHandler<Object> getDeleteHandler()
setDeleteHandler
public void setDeleteHandler(DeleteHandler<Object> deleteHandler)
getNamedQuery
public String getNamedQuery()
setNamedQuery
public void setNamedQuery(String namedQuery)
getNativeQuery
public String getNativeQuery()
setNativeQuery
public void setNativeQuery(String nativeQuery)
getQuery
public String getQuery()
setQuery
public void setQuery(String query)
getResultClass
public Class getResultClass()
setResultClass
public void setResultClass(Class resultClass)
lockEntity
protected boolean lockEntity(Object entity,
javax.persistence.EntityManager entityManager)
- A strategy method to lock an object with an exclusive lock so that it can
be processed
- Parameters:
entity - the entity to be lockedentityManager - entity manager
- Returns:
- true if the entity was locked
createQueryFactory
protected QueryFactory createQueryFactory()
getEntityName
protected String getEntityName(Class<?> clazz)
createDeleteHandler
protected DeleteHandler<Object> createDeleteHandler()
configureParameters
protected void configureParameters(javax.persistence.Query query)
createExchange
protected org.apache.camel.Exchange createExchange(Object result)
Apache CAMEL