@UriEndpoint(firstVersion="1.0.0", scheme="jpa", title="JPA", syntax="jpa:entityType", consumerClass=JpaConsumer.class, label="database,sql") public class JpaEndpoint extends org.apache.camel.impl.ScheduledPollEndpoint
Constructor and Description |
---|
JpaEndpoint() |
JpaEndpoint(String endpointUri)
Deprecated.
use
JpaEndpoint(String, JpaComponent) instead |
JpaEndpoint(String endpointUri,
javax.persistence.EntityManagerFactory entityManagerFactory)
Deprecated.
use
JpaEndpoint(String, JpaComponent) instead |
JpaEndpoint(String endpointUri,
javax.persistence.EntityManagerFactory entityManagerFactory,
org.springframework.transaction.PlatformTransactionManager transactionManager)
Deprecated.
use
JpaEndpoint(String, JpaComponent) instead |
JpaEndpoint(String uri,
JpaComponent component) |
Modifier and Type | Method and Description |
---|---|
void |
configureProperties(Map<String,Object> options) |
org.apache.camel.Consumer |
createConsumer(org.apache.camel.Processor processor) |
protected String |
createEndpointUri() |
protected javax.persistence.EntityManager |
createEntityManager()
Deprecated.
use
getEntityManagerFactory() to get hold of factory and create an entity manager using the factory. |
protected javax.persistence.EntityManagerFactory |
createEntityManagerFactory() |
org.apache.camel.PollingConsumer |
createPollingConsumer() |
org.apache.camel.Producer |
createProducer() |
protected org.apache.camel.Expression |
createProducerExpression() |
protected org.springframework.transaction.PlatformTransactionManager |
createTransactionManager() |
protected org.springframework.transaction.support.TransactionTemplate |
createTransactionTemplate() |
JpaComponent |
getComponent() |
DeleteHandler<Object> |
getDeleteHandler() |
javax.persistence.EntityManagerFactory |
getEntityManagerFactory() |
Map<String,Object> |
getEntityManagerProperties()
Additional properties for the entity manager to use.
|
Class<?> |
getEntityType() |
javax.persistence.LockModeType |
getLockModeType() |
int |
getMaximumResults() |
int |
getMaxMessagesPerPoll() |
String |
getNamedQuery() |
String |
getNativeQuery() |
Map<String,Object> |
getParameters() |
String |
getPersistenceUnit() |
DeleteHandler<Object> |
getPreDeleteHandler() |
org.apache.camel.Expression |
getProducerExpression() |
String |
getQuery() |
Class<?> |
getResultClass() |
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager() |
boolean |
isConsumeDelete() |
boolean |
isConsumeLockEntity() |
boolean |
isFlushOnSend() |
boolean |
isJoinTransaction() |
boolean |
isRemove() |
boolean |
isSharedEntityManager() |
boolean |
isSingleton() |
boolean |
isSkipLockedEntity() |
boolean |
isTransacted() |
Boolean |
isUseExecuteUpdate() |
boolean |
isUsePassedInEntityManager() |
boolean |
isUsePersist() |
void |
setConsumeDelete(boolean consumeDelete)
If true, the entity is deleted after it is consumed; if false, the entity is not deleted.
|
void |
setConsumeLockEntity(boolean consumeLockEntity)
Specifies whether or not to set an exclusive lock on each entity bean while processing the results from polling.
|
void |
setDeleteHandler(DeleteHandler<Object> deleteHandler)
To use a custom DeleteHandler to delete the row after the consumer is done processing the exchange
|
void |
setEntityManagerFactory(javax.persistence.EntityManagerFactory entityManagerFactory)
The
EntityManagerFactory to use. |
void |
setEntityManagerProperties(Map<String,Object> entityManagerProperties) |
void |
setEntityType(Class<?> entityType)
The JPA annotated class to use as entity.
|
void |
setFlushOnSend(boolean flushOnSend)
Flushes the EntityManager after the entity bean has been persisted.
|
void |
setJoinTransaction(boolean joinTransaction)
The camel-jpa component will join transaction by default.
|
void |
setLockModeType(javax.persistence.LockModeType lockModeType)
To configure the lock mode on the consumer.
|
void |
setMaximumResults(int maximumResults)
Set the maximum number of results to retrieve on the Query.
|
void |
setMaxMessagesPerPoll(int maxMessagesPerPoll)
An integer value to define the maximum number of messages to gather per poll.
|
void |
setNamedQuery(String namedQuery)
To use a named query.
|
void |
setNativeQuery(String nativeQuery)
To use a custom native query.
|
void |
setParameters(Map<String,Object> parameters)
This key/value mapping is used for building the query parameters.
|
void |
setPersistenceUnit(String persistenceUnit)
The JPA persistence unit used by default.
|
void |
setPreDeleteHandler(DeleteHandler<Object> preDeleteHandler)
To use a custom Pre-DeleteHandler to delete the row after the consumer has read the entity.
|
void |
setProducerExpression(org.apache.camel.Expression producerExpression) |
void |
setQuery(String query)
To use a custom query.
|
void |
setRemove(boolean isRemove)
Indicates to use entityManager.remove(entity).
|
void |
setResultClass(Class<?> resultClass)
Defines the type of the returned payload (we will call entityManager.createNativeQuery(nativeQuery, resultClass)
instead of entityManager.createNativeQuery(nativeQuery)).
|
void |
setSharedEntityManager(boolean sharedEntityManager)
Whether to use Spring's SharedEntityManager for the consumer/producer.
|
void |
setSkipLockedEntity(boolean skipLockedEntity)
To configure whether to use NOWAIT on lock and silently skip the entity.
|
void |
setTransacted(boolean transacted)
Whether to run the consumer in transacted mode, by which all messages will either commit or rollback,
when the entire batch has been processed.
|
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
To use the
PlatformTransactionManager for managing transactions. |
void |
setUseExecuteUpdate(Boolean useExecuteUpdate)
To configure whether to use executeUpdate() when producer executes a query.
|
void |
setUsePassedInEntityManager(boolean usePassedIn)
If set to true, then Camel will use the EntityManager from the header
JpaConstants.ENTITYMANAGER instead of the configured entity manager on the component/endpoint.
|
void |
setUsePersist(boolean usePersist)
Indicates to use entityManager.persist(entity) instead of entityManager.merge(entity).
|
protected void |
validate() |
configurePollingConsumer, configureScheduledPollConsumerProperties, doStart, doStop, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDelay, getInitialDelay, getPollStrategy, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, initConsumerProperties, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay
configureConsumer, createEndpointConfiguration, createExchange, createExchange, createExchange, equals, getCamelContext, getConsumerProperties, getEndpointConfiguration, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isBridgeErrorHandler, isLenientProperties, isPollingConsumerBlockWhenFull, isSynchronous, setBridgeErrorHandler, setCamelContext, setConsumerProperties, setEndpointConfiguration, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public JpaEndpoint()
@Deprecated public JpaEndpoint(String endpointUri)
JpaEndpoint(String, JpaComponent)
insteadpublic JpaEndpoint(String uri, JpaComponent component)
@Deprecated public JpaEndpoint(String endpointUri, javax.persistence.EntityManagerFactory entityManagerFactory)
JpaEndpoint(String, JpaComponent)
instead@Deprecated public JpaEndpoint(String endpointUri, javax.persistence.EntityManagerFactory entityManagerFactory, org.springframework.transaction.PlatformTransactionManager transactionManager)
JpaEndpoint(String, JpaComponent)
insteadpublic JpaComponent getComponent()
getComponent
in class org.apache.camel.impl.DefaultEndpoint
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
Exception
public org.apache.camel.PollingConsumer createPollingConsumer() throws Exception
createPollingConsumer
in interface org.apache.camel.Endpoint
createPollingConsumer
in class org.apache.camel.impl.DefaultEndpoint
Exception
public void configureProperties(Map<String,Object> options)
configureProperties
in interface org.apache.camel.Endpoint
configureProperties
in class org.apache.camel.impl.ScheduledPollEndpoint
public boolean isSingleton()
protected String createEndpointUri()
createEndpointUri
in class org.apache.camel.impl.DefaultEndpoint
public org.apache.camel.Expression getProducerExpression()
public void setProducerExpression(org.apache.camel.Expression producerExpression)
public int getMaximumResults()
public void setMaximumResults(int maximumResults)
public Class<?> getEntityType()
public void setEntityType(Class<?> entityType)
public javax.persistence.EntityManagerFactory getEntityManagerFactory()
public void setEntityManagerFactory(javax.persistence.EntityManagerFactory entityManagerFactory)
EntityManagerFactory
to use.public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
PlatformTransactionManager
for managing transactions.public Map<String,Object> getEntityManagerProperties()
public void setEntityManagerProperties(Map<String,Object> entityManagerProperties)
public String getPersistenceUnit()
public void setPersistenceUnit(String persistenceUnit)
public boolean isConsumeDelete()
public void setConsumeDelete(boolean consumeDelete)
public boolean isConsumeLockEntity()
public void setConsumeLockEntity(boolean consumeLockEntity)
public boolean isFlushOnSend()
public void setFlushOnSend(boolean flushOnSend)
public int getMaxMessagesPerPoll()
public void setMaxMessagesPerPoll(int maxMessagesPerPoll)
public boolean isUsePersist()
public void setUsePersist(boolean usePersist)
public boolean isRemove()
public void setRemove(boolean isRemove)
public boolean isJoinTransaction()
public void setJoinTransaction(boolean joinTransaction)
public boolean isUsePassedInEntityManager()
public void setUsePassedInEntityManager(boolean usePassedIn)
public boolean isSharedEntityManager()
public void setSharedEntityManager(boolean sharedEntityManager)
public String getQuery()
public void setQuery(String query)
public String getNamedQuery()
public void setNamedQuery(String namedQuery)
public String getNativeQuery()
public void setNativeQuery(String nativeQuery)
public javax.persistence.LockModeType getLockModeType()
public void setLockModeType(javax.persistence.LockModeType lockModeType)
public void setParameters(Map<String,Object> parameters)
This key/value mapping is used for building the query parameters.
It is expected to be of the generic type java.util.Map
When it's used for producer, Simple expression can be used as a parameter value. It allows you to retrieve parameter values from the message body, header and etc.
public Class<?> getResultClass()
public void setResultClass(Class<?> resultClass)
public boolean isTransacted()
public void setTransacted(boolean transacted)
public boolean isSkipLockedEntity()
public void setSkipLockedEntity(boolean skipLockedEntity)
public DeleteHandler<Object> getDeleteHandler()
public void setDeleteHandler(DeleteHandler<Object> deleteHandler)
public DeleteHandler<Object> getPreDeleteHandler()
public void setPreDeleteHandler(DeleteHandler<Object> preDeleteHandler)
public Boolean isUseExecuteUpdate()
public void setUseExecuteUpdate(Boolean useExecuteUpdate)
protected void validate()
protected javax.persistence.EntityManagerFactory createEntityManagerFactory()
protected org.springframework.transaction.PlatformTransactionManager createTransactionManager()
@Deprecated protected javax.persistence.EntityManager createEntityManager()
getEntityManagerFactory()
to get hold of factory and create an entity manager using the factory.protected org.springframework.transaction.support.TransactionTemplate createTransactionTemplate()
protected org.apache.camel.Expression createProducerExpression()
Apache Camel