[3/4] git commit: Fixed the CS issue of camel-jaxb
Fixed the CS issue of camel-jaxb Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ca5b6fbc Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ca5b6fbc Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ca5b6fbc Branch: refs/heads/master Commit: ca5b6fbc0ee430e0ae43975b56659f5a2d6b3bae Parents: 22c5f01 Author: Willem Jiang Authored: Thu Aug 22 14:12:17 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 14:12:17 2013 +0800 -- .../main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ca5b6fbc/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java -- diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java index a757b90..8118d89 100644 --- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java +++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java @@ -46,6 +46,8 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; +import org.xml.sax.SAXException; + import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.Exchange; @@ -58,7 +60,6 @@ import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.ResourceHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.xml.sax.SAXException; /**
[2/4] git commit: Clean up the code of XmlRpcProducer
Clean up the code of XmlRpcProducer Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/22c5f01a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/22c5f01a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/22c5f01a Branch: refs/heads/master Commit: 22c5f01a6929f70e0629d598ef8ac1966b660936 Parents: b090b18 Author: Willem Jiang Authored: Thu Aug 22 14:10:54 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 14:10:54 2013 +0800 -- .../java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/22c5f01a/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java -- diff --git a/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java b/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java index a66d2a2..04be300 100644 --- a/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java +++ b/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java @@ -48,7 +48,7 @@ public class XmlRpcProducer extends DefaultProducer implements AsyncProcessor { Object result = client.execute(operationName, in.getBody(List.class)); //TODO what if the request is one way operation // copy the in message header to the out message -exchange.getOut().setHeaders(exchange.getIn().getHeaders()); +exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders()); exchange.getOut().setBody(result); }
[1/4] git commit: Fixed the CS error of camel-jpa
Updated Branches: refs/heads/master 3115d05ed -> 6f489f1d8 Fixed the CS error of camel-jpa Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b090b186 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b090b186 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b090b186 Branch: refs/heads/master Commit: b090b186126202480082021bf7ca6727d90f33db Parents: 3115d05 Author: Willem Jiang Authored: Thu Aug 22 14:10:18 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 14:10:18 2013 +0800 -- .../apache/camel/component/jpa/JpaConsumer.java | 8 ++--- .../apache/camel/component/jpa/JpaEndpoint.java | 16 - .../apache/camel/component/jpa/JpaProducer.java | 20 +-- .../idempotent/jpa/JpaMessageIdRepository.java | 28 +++ .../component/jpa/AbstractJpaMethodTest.java| 8 ++--- .../org/apache/camel/component/jpa/JpaTest.java | 11 +++--- .../camel/component/jpa/JpaUseMergeTest.java| 2 +- .../component/jpa/JpaWithNamedQueryTest.java| 6 ++-- .../interceptor/JpaTraceEventMessageTest.java | 17 - .../camel/processor/jpa/AbstractJpaTest.java| 11 +++--- .../jpa/FileConsumerJpaIdempotentTest.java | 25 +++--- .../processor/jpa/JpaBatchConsumerTest.java | 16 - .../camel/processor/jpa/JpaFlushOnSendTest.java | 16 - .../jpa/JpaIdempotentConsumerTest.java | 36 ++-- .../processor/jpa/JpaNonTXRollbackTest.java | 16 - .../jpa/JpaProducerConcurrentTest.java | 16 - .../processor/jpa/JpaProducerNoBodyTest.java| 16 - .../jpa/JpaRouteConsumeLockEntityTest.java | 18 +- .../jpa/JpaRouteMaximumResultsTest.java | 16 - .../camel/processor/jpa/JpaRouteTest.java | 16 - .../jpa/JpaRoutemaxMessagesPerPollTest.java | 16 - .../camel/processor/jpa/JpaTXRollbackTest.java | 16 - 22 files changed, 176 insertions(+), 174 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b090b186/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java index a4a73e4..b48b871 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java @@ -47,7 +47,7 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer { private static final Logger LOG = LoggerFactory.getLogger(JpaConsumer.class); private final JpaEndpoint endpoint; - private final EntityManager entityManager; +private final EntityManager entityManager; private final TransactionTemplate transactionTemplate; private QueryFactory queryFactory; private DeleteHandler deleteHandler; @@ -81,9 +81,9 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer { Object messagePolled = transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { - entityManager.joinTransaction(); - - Queue answer = new LinkedList(); +entityManager.joinTransaction(); + +Queue answer = new LinkedList(); Query query = getQueryFactory().createQuery(entityManager); configureParameters(query); http://git-wip-us.apache.org/repos/asf/camel/blob/b090b186/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java index dc17d3f..78c64d2 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java @@ -250,11 +250,11 @@ public class JpaEndpoint extends ScheduledPollEndpoint { } protected EntityManagerFactory createEntityManagerFactory() { - LocalEntityManagerFactoryBean emfBean = new LocalEntityManagerFactoryBean(); - emfBean.setPersistenceUnitName(persistenceUnit); - emfBean.setJpaPropertyMap(getEntityManagerProperties()); - emfBean.afterPropertiesSet(); - return emfBean.getObject(); +LocalEntityManagerFactoryBean emfBean = new LocalEntityManagerFactoryBean(); +emfBean.setPersistenceUnitN
[4/4] git commit: CAMEL-6656 fixed the issue that spring-batch losses header
CAMEL-6656 fixed the issue that spring-batch losses header Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6f489f1d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6f489f1d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6f489f1d Branch: refs/heads/master Commit: 6f489f1d8105a7eb148c686147bc9f72a92eb9a7 Parents: ca5b6fb Author: Willem Jiang Authored: Thu Aug 22 14:37:37 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 14:37:37 2013 +0800 -- .../component/spring/batch/SpringBatchProducer.java | 1 + .../spring/batch/SpringBatchIntegrationTest.java | 11 +++ .../component/spring/batch/springBatchtestContext.xml| 5 + 3 files changed, 17 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/6f489f1d/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java -- diff --git a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java index 332348f..4fc5395 100644 --- a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java +++ b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java @@ -46,6 +46,7 @@ public class SpringBatchProducer extends DefaultProducer { public void process(Exchange exchange) throws Exception { JobParameters jobParameters = prepareJobParameters(exchange.getIn().getHeaders()); JobExecution jobExecution = jobLauncher.run(job, jobParameters); +exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders()); exchange.getOut().setBody(jobExecution); } http://git-wip-us.apache.org/repos/asf/camel/blob/6f489f1d/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java -- diff --git a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java index 77e3ad2..ea17b28 100644 --- a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java +++ b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java @@ -25,6 +25,8 @@ import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringBatchIntegrationTest extends CamelSpringTestSupport { +@EndpointInject(uri = "mock:header") +MockEndpoint headerEndpoint; @EndpointInject(uri = "mock:output") MockEndpoint outputEndpoint; @@ -60,6 +62,15 @@ public class SpringBatchIntegrationTest extends CamelSpringTestSupport { jobExecutionEventsQueueEndpoint.assertIsSatisfied(); } + +@Test +public void testMessageHeader() throws Exception { +headerEndpoint.expectedHeaderReceived("header", 1); + +template.sendBodyAndHeader(null, "header", "1"); + +headerEndpoint.assertIsSatisfied(); +} @Override protected AbstractApplicationContext createApplicationContext() { http://git-wip-us.apache.org/repos/asf/camel/blob/6f489f1d/components/camel-spring-batch/src/test/resources/org/apache/camel/component/spring/batch/springBatchtestContext.xml -- diff --git a/components/camel-spring-batch/src/test/resources/org/apache/camel/component/spring/batch/springBatchtestContext.xml b/components/camel-spring-batch/src/test/resources/org/apache/camel/component/spring/batch/springBatchtestContext.xml index a4161e8..d8fb231 100644 --- a/components/camel-spring-batch/src/test/resources/org/apache/camel/component/spring/batch/springBatchtestContext.xml +++ b/components/camel-spring-batch/src/test/resources/org/apache/camel/component/spring/batch/springBatchtestContext.xml @@ -50,6 +50,11 @@ Echo ${body} + + + + +
[CONF] Apache Camel > SEDA
SEDA Page edited by Claus Ibsen Changes (2) ... | {{queue}} | *2.12.0* | null | Define the queue instance which will be used by seda endpoint | | {{queueFactory}} | *2.12.0* | null | Define the QueueFactory which could create the queue for the seda endpoint | | {{failIfNoConsumers}} | *2.12.0* | false | When the seda producer send the message to queue, the SedaConsumerNotAvailableException will be thrown if the failIfNoConsumers is true| | {{failIfNoConsumers}} | *2.12.0* | false | Whether the producer should fail by throwing an exception, when sending to a SEDA queue with no active consumers. | {div} ... Full Content SEDA Component The seda: component provides asynchronous SEDA behavior, so that messages are exchanged on a BlockingQueue and consumers are invoked in a separate thread from the producer. Note that queues are only visible within a single CamelContext. If you want to communicate across CamelContext instances (for example, communicating between Web applications), see the VM component. This component does not implement any kind of persistence or recovery, if the VM terminates while messages are yet to be processed. If you need persistence, reliability or distributed SEDA, try using either JMS or ActiveMQ. SynchronousThe Direct component provides synchronous invocation of any consumers when a producer sends a message exchange. URI format seda:someName[?options] Where someName can be any string that uniquely identifies the endpoint within the current CamelContext. You can append query options to the URI in the following format: ?option=value&option=value&… Options Name Since Default Description size The maximum capacity of the SEDA queue (i.e., the number of messages it can hold). The default value in Camel 2.2 or older is 1000. From Camel 2.3 onwards, the size is unbounded by default. Notice: Mind if you use this option, then its the first endpoint being created with the queue name, that determines the size. To make sure all endpoints use same size, then configure the size option on all of them, or the first endpoint being created. From Camel 2.11 onwards, a validation is taken place to ensure if using mixed queue sizes for the same queue name, Camel would detect this and fail creating the endpoint. concurrentConsumers 1 Number of concurrent threads processing exchanges. waitForTaskToComplete IfReplyExpected Option to specify whether the caller should wait for the async task to complete or not before continuing. The following three options are supported: Always, Never or IfReplyExpected. The first two values are self-explanatory. The last value, IfReplyExpected, will only wait if the message is Request Reply based. The default option is IfReplyExpected. See more information about Async messaging. timeout 3 Timeout (in milliseconds) before a SEDA producer will stop waiting for an asynchronous task to complete. See waitForTaskToComplete and Async for more details. In Camel 2.2 you can now disable timeout by using 0 or a negative value. multipleConsumers 2.2 false Specifies whether multiple consumers are allowed. If enabled, you can use SEDA for Publish-Subscribe messaging. That is, you can send a message to the SEDA queue and have each consumer receive a copy of the message. When enabled, this option should be specified on every consumer endpoint. limitConcurrentConsumers 2.3 true Whether to limit the number of concurrentConsumers to the maximum of 500. By default, an exception will be thrown if a SEDA endpoint is configured with a greater number. You can disable that check by turning this option off. blockWhenFull 2.9 false Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted. By default, an exception will be thrown stating that the queue is full. By enabling this option, the calling thread will instead block and wait until the message can be accepted. queueSize 2.9 Component only: The maximum default size (capacity of the number of messages it can hold) of the SEDA queue. This option is used if size is not in use. pollTimeout 2.9.3 1000 Consumer only – The timeout used when polling. When a timeout occurs, the consumer can check whether it is allowed to continue running. Setting a lower value allows the consumer to react more quickly upon shutdown. purgeWhenStopping 2.11.1 false Whether to purge the task queue when stopping the consumer/route. This allows to stop faster, as any pending messages on the queue is discarded. queue 2.12.0 null Define the queue instance which will be used by seda endpoint queueFactor
svn commit: r875661 - in /websites/production/camel/content: avro.html book-component-appendix.html book-in-one-page.html cache/main.pageCache seda.html
Author: buildbot Date: Thu Aug 22 04:33:43 2013 New Revision: 875661 Log: Production update by buildbot for camel Modified: websites/production/camel/content/avro.html websites/production/camel/content/book-component-appendix.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/seda.html Modified: websites/production/camel/content/avro.html == --- websites/production/camel/content/avro.html (original) +++ websites/production/camel/content/avro.html Thu Aug 22 04:33:43 2013 @@ -179,7 +179,7 @@ class Value { ]]> -An alternative can be to specify the dataformat inisde the context and reference it from your route. +An alternative can be to specify the dataformat inside the context and reference it from your route. -For consumers this allows you to have multiple routes attach to the same socket. Dispatching to correct route will be done by the avro component automatically. Route with no messageName specified (if any) will be used as default. +For consumers this allows you to have multiple routes attached to the same socket. Dispatching to correct route will be done by the avro component automatically. Route with no messageName specified (if any) will be used as default. When using camel producers for avro ipc, the "in" message body needs to contain the parameters of the operation specified in the avro protocol. The response will be added in the body of the "out" message. Modified: websites/production/camel/content/book-component-appendix.html == --- websites/production/camel/content/book-component-appendix.html (original) +++ websites/production/camel/content/book-component-appendix.html Thu Aug 22 04:33:43 2013 @@ -3239,7 +3239,7 @@ from("activemq:SomeQueue").to("dataset:f Properties on SimpleDataSet -PropertyTypeDescriptiondefaultBody Object Specifies the default message body. For SimpleDataSet it is a constant payload; though if you want to create custom payloads per message, create your own derivation of DataSetSupport. reportGroup long Specifies the number of messages to be received before reporting progress. Useful for showing progress of a large load test.size long Specifies how many messages to send/consume. +PropertyTypeDefault DescriptiondefaultBody Objectworld! Specifies the default message body. For SimpleDataSet it is a constant payload; though if you want to create custom payloads per message, create your own derivation of DataSetSupport. reportCount long -1 Specifies the >number of messages to be received before reporting progress. Useful for >showing progress of a large load test. If < 0, then size / 5, if >is 0 then size, else set to reportCount >value.class="confluenceTd">size class="confluenceTd"> long class="confluenceTd"> 10 class="confluenceTd">Specifies how many messages to >send/consume. @@ -15146,7 +15146,7 @@ seda:someName[?options] Options - Name Since Default Description size The maximum capacity of the SEDA queue (i.e., the number of messages it can hold). The default value in Camel 2.2 or older is 1000. From Camel 2.3 onwards, the size is unbounded by default. Notice: Mind if you use this option, then its the first endpoint being created with the queue name, that determines the size. To make sure all endpoints use same size, then configure the size option on all of them, or the first endpoint being created . From Camel 2.11 onwards, a validation is taken place to ensure if using mixed queue sizes for the same queue name, Camel would detect this and fail creating the endpoint. concurrentConsumers 1 Number of concurrent threads processing exchanges. waitForTaskToComplete IfReplyExpected Option to specify whether the caller should wait for the async task to complete or not before continuing. The following three options are supported: Always, Never or IfReplyExpecte d. The first two values are self-explanatory. The last value, IfReplyExpected, will only wait if the message is Request Reply based. The default option is IfReplyExpected. See more information about Async messaging. timeout 3 Timeout (in milliseconds) before a SEDA producer will stop waiting for an asynchronous task to complete. See waitForTaskToComplete and Async for more details. In Camel 2.2 you can now disable timeout by using 0 or a negative value. mult ipleConsumers 2.2 false Specifies whether multiple consumers are allowed. If enabled, you can use SEDA for http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern"; rel="nofollow">Publish-Subscribe messaging. That is, you can send a message to the SEDA queue and have each
[5/5] git commit: CAMEL-6545 clean up the code
CAMEL-6545 clean up the code Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3115d05e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3115d05e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3115d05e Branch: refs/heads/master Commit: 3115d05eda06699e2fb7ab3d495b1f9648e084ca Parents: ba9e189 Author: Willem Jiang Authored: Thu Aug 22 11:42:02 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 11:42:02 2013 +0800 -- .../camel/component/seda/SedaConsumerNotAvailableException.java | 3 --- 1 file changed, 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/3115d05e/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumerNotAvailableException.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumerNotAvailableException.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumerNotAvailableException.java index d49e0b6..f3ec4d7 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumerNotAvailableException.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumerNotAvailableException.java @@ -19,9 +19,6 @@ package org.apache.camel.component.seda; import org.apache.camel.CamelExchangeException; import org.apache.camel.Exchange; -/** - * @author http://www.christianposta.com/blog";>Christian Posta - */ public class SedaConsumerNotAvailableException extends CamelExchangeException { private static final long serialVersionUID = 683242306650809007L;
[1/5] git commit: Fixed the CS errors in the camel-core
Updated Branches: refs/heads/master 228ff07a4 -> 3115d05ed Fixed the CS errors in the camel-core Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fd3794d4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fd3794d4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fd3794d4 Branch: refs/heads/master Commit: fd3794d4f23cd7b2e3796b32a62bcc95fae711e0 Parents: 228ff07 Author: Willem Jiang Authored: Thu Aug 22 08:38:30 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 08:38:30 2013 +0800 -- .../processor/aggregate/AggregationStrategyBeanAdapter.java | 4 ++-- .../org/apache/camel/impl/ScheduledPollConsumerBackoffTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/fd3794d4/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanAdapter.java -- diff --git a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanAdapter.java b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanAdapter.java index f33edde..a2bd45a 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanAdapter.java +++ b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanAdapter.java @@ -42,8 +42,8 @@ public final class AggregationStrategyBeanAdapter extends ServiceSupport impleme private Object pojo; private final Class type; private String methodName; -private boolean allowNullOldExchange = false; -private boolean allowNullNewExchange = false; +private boolean allowNullOldExchange; +private boolean allowNullNewExchange; private volatile AggregationStrategyMethodInfo mi; static { http://git-wip-us.apache.org/repos/asf/camel/blob/fd3794d4/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerBackoffTest.java -- diff --git a/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerBackoffTest.java b/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerBackoffTest.java index 95f0b8f..26d199a 100644 --- a/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerBackoffTest.java +++ b/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerBackoffTest.java @@ -23,8 +23,8 @@ import org.apache.camel.spi.PollingConsumerPollStrategy; public class ScheduledPollConsumerBackoffTest extends ContextTestSupport { -private static int commits = 0; -private static int errors = 0; +private static int commits; +private static int errors; public void testBackoffIdle() throws Exception {
[2/5] git commit: CAMEL-6545 seda producer - Add option to fail for non existing queue with thanks to Christian Posta
CAMEL-6545 seda producer - Add option to fail for non existing queue with thanks to Christian Posta Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/783a2f52 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/783a2f52 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/783a2f52 Branch: refs/heads/master Commit: 783a2f52d18074389508c0525c49acf303ca18ae Parents: fd3794d Author: Willem Jiang Authored: Thu Aug 22 08:48:43 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 08:48:43 2013 +0800 -- .../camel/component/seda/QueueReference.java| 93 .../camel/component/seda/SedaComponent.java | 89 .../seda/SedaConsumerNotAvailableException.java | 31 .../camel/component/seda/SedaEndpoint.java | 35 - .../camel/component/seda/SedaProducer.java | 30 +++- .../apache/camel/component/vm/VmComponent.java | 1 + .../SedaComponentReferenceEndpointTest.java | 2 +- .../component/seda/SedaNoConsumerTest.java | 140 ++- .../vm/VmComponentReferenceEndpointTest.java| 4 +- 9 files changed, 346 insertions(+), 79 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/783a2f52/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java b/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java new file mode 100644 index 000..5b7fd50 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java @@ -0,0 +1,93 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.seda; + +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.BlockingQueue; + +import org.apache.camel.Exchange; + +/** + * Holder for queue references. + * + * This is used to keep track of the usages of the queues, so we know when a queue is no longer + * in use, and can safely be discarded. + */ +public final class QueueReference { + +private final BlockingQueue queue; +private Integer size; +private Boolean multipleConsumers; + +private List endpoints = new LinkedList(); + +QueueReference(BlockingQueue queue, Integer size, Boolean multipleConsumers) { +this.queue = queue; +this.size = size; +this.multipleConsumers = multipleConsumers; +} + +synchronized void addReference(SedaEndpoint endpoint) { +if (!endpoints.contains(endpoint)) { +endpoints.add(endpoint); +} +} + +synchronized void removeReference(SedaEndpoint endpoint) { +if (endpoints.contains(endpoint)) { +endpoints.remove(endpoint); +} +} + +/** + * Gets the reference counter + */ +public synchronized int getCount() { +return endpoints.size(); +} + +/** + * Gets the queue size + * + * @return null if unbounded + */ +public Integer getSize() { +return size; +} + +public Boolean getMultipleConsumers() { +return multipleConsumers; +} + +/** + * Gets the queue + */ +public BlockingQueue getQueue() { +return queue; +} + +public synchronized boolean hasConsumers() { +for (SedaEndpoint endpoint : endpoints) { +if (endpoint.getConsumers().size() > 0) { +return true; +} +} + +return false; +} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/783a2f52/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java index 6b8d81a..64415b3 100644 --- a/camel-core/sr
[3/5] git commit: Fixed the ecilpse warning of camel-core
Fixed the ecilpse warning of camel-core Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/11e954fb Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/11e954fb Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/11e954fb Branch: refs/heads/master Commit: 11e954fb09f6ca19b8db8e5e136c01f22dddf00c Parents: 783a2f5 Author: Willem Jiang Authored: Thu Aug 22 09:57:44 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 09:57:44 2013 +0800 -- .../camel/converter/stream/CachedOutputStream.java| 7 +++ .../apache/camel/component/bean/BeanMapPutTest.java | 3 +-- .../converter/stream/CachedOutputStreamTest.java | 14 +++--- .../camel/impl/CamelPostProcessorHelperTest.java | 3 +-- 4 files changed, 16 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/11e954fb/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java -- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java b/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java index 7db0d51..c5f3b49 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java @@ -230,8 +230,15 @@ public class CachedOutputStream extends OutputStream { } } +/** + * @deprecated use {@link #getStrategyBufferSize()} + */ @Deprecated public int getBufferSize() { +return getStrategyBufferSize(); +} + +public int getStrategyBufferSize() { return strategy.getBufferSize(); } http://git-wip-us.apache.org/repos/asf/camel/blob/11e954fb/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java -- diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java index 4743f75..d6c9fd8 100644 --- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java @@ -21,7 +21,6 @@ import java.util.Map; import org.apache.camel.ContextTestSupport; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.impl.JndiRegistry; /** @@ -29,7 +28,7 @@ import org.apache.camel.impl.JndiRegistry; */ public class BeanMapPutTest extends ContextTestSupport { -private Map myMap = new HashMap(); +private Map myMap = new HashMap(); @Override protected JndiRegistry createRegistry() throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/11e954fb/camel-core/src/test/java/org/apache/camel/converter/stream/CachedOutputStreamTest.java -- diff --git a/camel-core/src/test/java/org/apache/camel/converter/stream/CachedOutputStreamTest.java b/camel-core/src/test/java/org/apache/camel/converter/stream/CachedOutputStreamTest.java index a705e1a..39fac58 100644 --- a/camel-core/src/test/java/org/apache/camel/converter/stream/CachedOutputStreamTest.java +++ b/camel-core/src/test/java/org/apache/camel/converter/stream/CachedOutputStreamTest.java @@ -87,7 +87,7 @@ public class CachedOutputStreamTest extends ContextTestSupport { assertEquals("we should have a temp file", files.length, 1); assertTrue("The file name should start with cos" , files[0].startsWith("cos")); -StreamCache cache = cos.getStreamCache(); +StreamCache cache = cos.newStreamCache(); assertTrue("Should get the FileInputStreamCache", cache instanceof FileInputStreamCache); String temp = toString((InputStream)cache); @@ -131,7 +131,7 @@ public class CachedOutputStreamTest extends ContextTestSupport { assertTrue("The content is not encrypted", temp.length() > 0 && temp.indexOf("aaa") < 0); tmpin.close(); -StreamCache cache = cos.getStreamCache(); +StreamCache cache = cos.newStreamCache(); assertTrue("Should get the FileInputStreamCache", cache instanceof FileInputStreamCache); temp = toString((InputStream)cache); @@ -166,7 +166,7 @@ public class CachedOutputStreamTest extends ContextTestSupport { assertEquals("we should have a temp file", files.length, 1); assertTrue("The file name should start with cos" , files[0].startsWith("cos")); -StreamCache cache = cos.getStreamCache(); +StreamCache
[4/5] git commit: CAMEL-6545 Fixed the VM component tests errors
CAMEL-6545 Fixed the VM component tests errors Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ba9e189d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ba9e189d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ba9e189d Branch: refs/heads/master Commit: ba9e189d7c027131cef2f143da1422a32464ebd6 Parents: 11e954f Author: Willem Jiang Authored: Thu Aug 22 09:58:33 2013 +0800 Committer: Willem Jiang Committed: Thu Aug 22 09:58:33 2013 +0800 -- .../java/org/apache/camel/component/seda/QueueReference.java | 4 .../java/org/apache/camel/component/seda/SedaComponent.java | 8 +--- .../main/java/org/apache/camel/component/vm/VmComponent.java | 5 + 3 files changed, 14 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ba9e189d/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java b/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java index 5b7fd50..17a03cd 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/QueueReference.java @@ -45,6 +45,10 @@ public final class QueueReference { synchronized void addReference(SedaEndpoint endpoint) { if (!endpoints.contains(endpoint)) { endpoints.add(endpoint); +// update the multipleConsumers setting if need +if (endpoint.isMultipleConsumers()) { +multipleConsumers = true; +} } } http://git-wip-us.apache.org/repos/asf/camel/blob/ba9e189d/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java index 64415b3..94623f8 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java @@ -82,7 +82,7 @@ public class SedaComponent extends UriEndpointComponent { return getOrCreateQueue(endpoint, size, multipleConsumers, null); } -public synchronized QueueReference getOrCreateQueue(SedaEndpoint endpoint, Integer size, Boolean multipleConsumers, BlockingQueueFactory customQueueFactory) { +public synchronized QueueReference getOrCreateQueue(SedaEndpoint endpoint, Integer size, Boolean multipleConsumers, BlockingQueueFactory customQueueFactory) { String key = getQueueKey(endpoint.getEndpointUri()); QueueReference ref = getQueues().get(key); @@ -126,7 +126,7 @@ public class SedaComponent extends UriEndpointComponent { return ref; } -public synchronized QueueReference registerQueue(SedaEndpoint endpoint, BlockingQueue queue) { +public synchronized QueueReference registerQueue(SedaEndpoint endpoint, BlockingQueue queue) { String key = getQueueKey(endpoint.getEndpointUri()); QueueReference ref = getQueues().get(key); @@ -198,12 +198,14 @@ public class SedaComponent extends UriEndpointComponent { // we need to remove the endpoint from the reference counter String key = getQueueKey(endpoint.getEndpointUri()); QueueReference ref = getQueues().get(key); -if (ref != null) { +if (ref != null && endpoint.getConsumers().size() == 0) { +// only remove the endpoint when the consumers are removed ref.removeReference(endpoint); if (ref.getCount() <= 0) { // reference no longer needed so remove from queues getQueues().remove(key); } + } } http://git-wip-us.apache.org/repos/asf/camel/blob/ba9e189d/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java b/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java index 392d3c1..65c0836 100644 --- a/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java @@ -40,6 +40,11 @@ public class VmComponent extends SedaComponent { public Map getQueues() { return QUEUES; } + +@Override +public QueueReference getQueueReference(String key) { +return QUEUES.get(key); +} @Override
svn commit: r875657 - in /websites/production/camel/content: cache/main.pageCache dataset.html
Author: buildbot Date: Thu Aug 22 03:36:00 2013 New Revision: 875657 Log: Production update by buildbot for camel Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/dataset.html Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/dataset.html == --- websites/production/camel/content/dataset.html (original) +++ websites/production/camel/content/dataset.html Thu Aug 22 03:36:00 2013 @@ -143,7 +143,7 @@ from("activemq:SomeQueue").to("dataset:f Properties on SimpleDataSet -PropertyTypeDescriptiondefaultBody Object Specifies the default message body. For SimpleDataSet it is a constant payload; though if you want to create custom payloads per message, create your own derivation of DataSetSupport. reportGroup long Specifies the number of messages to be received before reporting progress. Useful for showing progress of a large load test.size long Specifies how many messages to send/consume. +PropertyTypeDefault DescriptiondefaultBody Objectworld! Specifies the default message body. For SimpleDataSet it is a constant payload; though if you want to create custom payloads per message, create your own derivation of DataSetSupport. reportCount long -1 Specifies the >number of messages to be received before reporting progress. Useful for >showing progress of a large load test. If < 0, then size / 5, if >is 0 then size, else set to reportCount >value.class="confluenceTd">size class="confluenceTd"> long class="confluenceTd"> 10 class="confluenceTd">Specifies how many messages to >send/consume.
[CONF] Apache Camel > SEDA
SEDA Page edited by willem jiang Comment: CAMEL-6545 Changes (1) ... | {{queue}} | *2.12.0* | null | Define the queue instance which will be used by seda endpoint | | {{queueFactory}} | *2.12.0* | null | Define the QueueFactory which could create the queue for the seda endpoint | | {{failIfNoConsumers}} | *2.12.0* | false | When the seda producer send the message to queue, the SedaConsumerNotAvailableException will be thrown if the failIfNoConsumers is true| {div} ... Full Content SEDA Component The seda: component provides asynchronous SEDA behavior, so that messages are exchanged on a BlockingQueue and consumers are invoked in a separate thread from the producer. Note that queues are only visible within a single CamelContext. If you want to communicate across CamelContext instances (for example, communicating between Web applications), see the VM component. This component does not implement any kind of persistence or recovery, if the VM terminates while messages are yet to be processed. If you need persistence, reliability or distributed SEDA, try using either JMS or ActiveMQ. SynchronousThe Direct component provides synchronous invocation of any consumers when a producer sends a message exchange. URI format seda:someName[?options] Where someName can be any string that uniquely identifies the endpoint within the current CamelContext. You can append query options to the URI in the following format: ?option=value&option=value&… Options Name Since Default Description size The maximum capacity of the SEDA queue (i.e., the number of messages it can hold). The default value in Camel 2.2 or older is 1000. From Camel 2.3 onwards, the size is unbounded by default. Notice: Mind if you use this option, then its the first endpoint being created with the queue name, that determines the size. To make sure all endpoints use same size, then configure the size option on all of them, or the first endpoint being created. From Camel 2.11 onwards, a validation is taken place to ensure if using mixed queue sizes for the same queue name, Camel would detect this and fail creating the endpoint. concurrentConsumers 1 Number of concurrent threads processing exchanges. waitForTaskToComplete IfReplyExpected Option to specify whether the caller should wait for the async task to complete or not before continuing. The following three options are supported: Always, Never or IfReplyExpected. The first two values are self-explanatory. The last value, IfReplyExpected, will only wait if the message is Request Reply based. The default option is IfReplyExpected. See more information about Async messaging. timeout 3 Timeout (in milliseconds) before a SEDA producer will stop waiting for an asynchronous task to complete. See waitForTaskToComplete and Async for more details. In Camel 2.2 you can now disable timeout by using 0 or a negative value. multipleConsumers 2.2 false Specifies whether multiple consumers are allowed. If enabled, you can use SEDA for Publish-Subscribe messaging. That is, you can send a message to the SEDA queue and have each consumer receive a copy of the message. When enabled, this option should be specified on every consumer endpoint. limitConcurrentConsumers 2.3 true Whether to limit the number of concurrentConsumers to the maximum of 500. By default, an exception will be thrown if a SEDA endpoint is configured with a greater number. You can disable that check by turning this option off. blockWhenFull 2.9 false Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted. By default, an exception will be thrown stating that the queue is full. By enabling this option, the calling thread will instead block and wait until the message can be accepted. queueSize 2.9 Component only: The maximum default size (capacity of the number of messages it can hold) of the SEDA queue. This option is used if size is not in use. pollTimeout 2.9.3 1000 Consumer only – The timeout used when polling. When a timeout occurs, the consumer can check whether it is allowed to continue running. Setting a lower value allows the consumer to react more quickly upon shutdown. purgeWhenStopping 2.11.1 false Whether to purge the task queue when stopping the consumer/route. This allows to stop faster, as any pending messages on the queue is discarded. queue 2.12.0 null Define the queue instance which will be used by seda endpoint queueFactory 2.12.0 null Define the QueueFactory which could create the queue for the seda endpoint failIfNoConsumers 2.12
[CONF] Apache Camel > DataSet
DataSet Page edited by Zemian Deng Comment: Corrected reportGroup to reportCount, and added default values. Changes (4) ... h3. Properties on SimpleDataSet {div:class=confluenceTableSmall} ||Property||Type||Default|| Description|| |{{defaultBody}} | {{Object}} | {{world!}} | Specifies the default message body. For SimpleDataSet it is a constant payload; though if you want to create custom payloads per message, create your own derivation of {{DataSetSupport}}. | |{{reportGroup}} |{{reportCount}} | {{long}} | {{-1}} | Specifies the number of messages to be received before reporting progress. Useful for showing progress of a large load test. If < 0, then {{size}} / 5, if is 0 then {{size}}, else set to {{reportCount}} value.| |{{size}} | {{long}} | {{10}} |Specifies how many messages to send/consume.| {div} ... Full Content DataSet Component Testing of distributed and asynchronous processing is notoriously difficult. The Mock, Test and DataSet endpoints work great with the Camel Testing Framework to simplify your unit and integration testing using Enterprise Integration Patterns and Camel's large range of Components together with the powerful Bean Integration. The DataSet component provides a mechanism to easily perform load & soak testing of your system. It works by allowing you to create DataSet instances both as a source of messages and as a way to assert that the data set is received. Camel will use the throughput logger when sending dataset's. URI format dataset:name[?options] Where name is used to find the DataSet instance in the Registry Camel ships with a support implementation of org.apache.camel.component.dataset.DataSet, the org.apache.camel.component.dataset.DataSetSupport class, that can be used as a base for implementing your own DataSet. Camel also ships with a default implementation, the org.apache.camel.component.dataset.SimpleDataSet that can be used for testing. Options Option Default Description produceDelay 3 Allows a delay in ms to be specified, which causes producers to pause in order to simulate slow producers. Uses a minimum of 3 ms delay unless you set this option to -1 to force no delay at all. consumeDelay 0 Allows a delay in ms to be specified, which causes consumers to pause in order to simulate slow consumers. preloadSize 0 Sets how many messages should be preloaded (sent) before the route completes its initialization. initialDelay 1000 Camel 2.1: Time period in millis to wait before starting sending messages. minRate 0 Wait until the DataSet contains at least this number of messages You can append query options to the URI in the following format, ?option=value&option=value&... Configuring DataSet Camel will lookup in the Registry for a bean implementing the DataSet interface. So you can register your own DataSet as: Example For example, to test that a set of messages are sent to a queue and then consumed from the queue without losing any messages: // send the dataset to a queue from("dataset:foo").to("activemq:SomeQueue"); // now lets test that the messages are consumed correctly from("activemq:SomeQueue").to("dataset:foo"); The above would look in the Registry to find the foo DataSet instance which is used to create the messages. Then you create a DataSet implementation, such as using the SimpleDataSet as described below, configuring things like how big the data set is and what the messages look like etc. Properties on SimpleDataSet Property Type Default Description defaultBody Object world! Specifies the default message body. For SimpleDataSet it is a constant payload; though if you want to create custom payloads per message, create your own derivation of DataSetSupport. reportCount long -1 Specifies the number of messages to be received before reporting progress. Useful for showing progress of a large load test. If < 0, then size / 5, if is 0 then size, else set to reportCount value. size long 10 Specifies how many messages to send/consume. See Also Configuring Camel Component Endpoint Getting Started Spring Testing Stop watching space | Change email notification preferences View Online | View Changes | Add Comment
svn commit: r875597 - in /websites/production/camel/content: book-component-appendix.html book-in-one-page.html cache/main.pageCache file2.html
Author: buildbot Date: Wed Aug 21 15:19:26 2013 New Revision: 875597 Log: Production update by buildbot for camel Modified: websites/production/camel/content/book-component-appendix.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/file2.html Modified: websites/production/camel/content/book-component-appendix.html == --- websites/production/camel/content/book-component-appendix.html (original) +++ websites/production/camel/content/book-component-appendix.html Wed Aug 21 15:19:26 2013 @@ -4499,7 +4499,7 @@ to use that as a pluggable hook for end For the file and ftp components this would be the case. However if you want to bridge the ExceptionHandler so it uses the Camel Error Handling, then you need to implement a custom ExceptionHandler that will handle the exception by creating a Camel Exchange and send it to the routing engine; then the error handling of the routing engine can get triggered. -https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"; width="16" height="16" alt="" border="0">Easier with Camel 2.10The new option consumer.bridgeErrorHandler can be set to true, to make this even easier. See further below +https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"; width="16" height="16" alt="" border="0">Easier with Camel 2.10The new option consumer.bridgeErrorHandler can be set to true, to make this even easier. See further below for more details. Here is such an example based upon an unit test. @@ -4620,6 +4620,8 @@ protected RouteBuilder createRouteBuilde So all you have to do is to enable this option, and the error handler in the route will take it from there. +https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif"; width="16" height="16" alt="" border="0">Important when using consumer.bridgeErrorHandlerWhen using consumer.bridgeErrorHandler, then interceptors, OnCompletions does not apply. The Exchange is processed directly by the Camel Error Handler, and does not allow prior actions such as interceptors, onCompletion to take action. + Debug logging This component has log level TRACE that can be helpful if you have problems. Modified: websites/production/camel/content/book-in-one-page.html == --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Wed Aug 21 15:19:26 2013 @@ -26190,7 +26190,7 @@ to use that as a pluggable hook for end For the file and ftp components this would be the case. However if you want to bridge the ExceptionHandler so it uses the Camel Error Handling, then you need to implement a custom ExceptionHandler that will handle the exception by creating a Camel Exchange and send it to the routing engine; then the error handling of the routing engine can get triggered. -https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"; width="16" height="16" alt="" border="0">Easier with Camel 2.10The new option consumer.bridgeErrorHandler can be set to true, to make this even easier. See further below +https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"; width="16" height="16" alt="" border="0">Easier with Camel 2.10The new option consumer.bridgeErrorHandler can be set to true, to make this even easier. See further below for more details. Here is such an example based upon an unit test. @@ -26311,6 +26311,8 @@ protected RouteBuilder createRouteBuilde So all you have to do is to enable this option, and the error handler in the route will take it from there. +https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif"; width="16" height="16" alt="" border="0">Important when using consumer.bridgeErrorHandlerWhen using consumer.bridgeErrorHandler, then interceptors, OnCompletions does not apply. The Exchange is processed directly by the Camel Error Handler, and does not allow prior actions such as interceptors, onCompletion to take action. + Debug logging This component has log level TRACE that can be helpful if you have problems. Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/file2.html == --- websites/production/camel/content/file2.html (original) +++ websites/production/camel/content/file2.html Wed Aug 21 15:19:26 2013 @@ -932,7 +932,7 @@ to use that as a pluggable hook for end For the file and ftp components this would be the case. However if you want to bridge the ExceptionHandler so it uses the Camel Error Handling, then
git commit: CAMEL-6287: Added note to javadoc about brdige error handler does not support interceptors, onCompletion etc.
Updated Branches: refs/heads/master 7cbedb6b2 -> 228ff07a4 CAMEL-6287: Added note to javadoc about brdige error handler does not support interceptors, onCompletion etc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/228ff07a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/228ff07a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/228ff07a Branch: refs/heads/master Commit: 228ff07a4475f56d96b300892c4a3c0128c596aa Parents: 7cbedb6 Author: Claus Ibsen Authored: Wed Aug 21 16:56:47 2013 +0200 Committer: Claus Ibsen Committed: Wed Aug 21 16:56:47 2013 +0200 -- .../apache/camel/impl/BridgeExceptionHandlerToErrorHandler.java | 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/228ff07a/camel-core/src/main/java/org/apache/camel/impl/BridgeExceptionHandlerToErrorHandler.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/BridgeExceptionHandlerToErrorHandler.java b/camel-core/src/main/java/org/apache/camel/impl/BridgeExceptionHandlerToErrorHandler.java index e8117c6..12ba590 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/BridgeExceptionHandlerToErrorHandler.java +++ b/camel-core/src/main/java/org/apache/camel/impl/BridgeExceptionHandlerToErrorHandler.java @@ -30,6 +30,11 @@ import org.apache.camel.spi.ExceptionHandler; * to enable this {@link BridgeExceptionHandlerToErrorHandler} on the consumer. * The consumer must extend the {@link DefaultConsumer}, to support this, if not an * {@link IllegalArgumentException} is thrown upon startup. + * + * Notice: When using this bridging error handler, then interceptors, onCompletions + * does not apply. The {@link Exchange} is processed directly by the Camel + * error handler, and does not allow prior actions such as interceptors, onCompletion + * to take action. */ public class BridgeExceptionHandlerToErrorHandler implements ExceptionHandler {
[CONF] Apache Camel > Release Guide
Release Guide Page edited by Babak Vahdat Changes (1) ... This release guide is based on the [General guide for releasing Maven-based projects at Apache|http://maven.apache.org/developers/release/apache-release.html], so be sure to check it out before continuing and meet all prerequisites. *Note*: Make sure that you are using *JDK 6*. However for releasing Camel 2.12.0 onwards better use *JDK 7*, this for the sake of the new [HTML documentation feature|http://camel.apache.org/endpoint-annotations.html] which doesn't work properly because of misbehaving annotation processing in *JDK 6*. h2. Prerequisites ... Full Content How to create and announce a Camel release. This release guide is based on the General guide for releasing Maven-based projects at Apache, so be sure to check it out before continuing and meet all prerequisites. Note: Make sure that you are using JDK 6. However for releasing Camel 2.12.0 onwards better use JDK 7, this for the sake of the new HTML documentation feature which doesn't work properly because of misbehaving annotation processing in JDK 6. Prerequisites To prepare or perform a release you MUST BE at least an Apache Camel committer. The artifacts for each and every release must be SIGNED; your public key should be added to the KEYS file Your public key must also be cross-signed by other Apache committers (this can be done at key signing parties at ApacheCon for instance) Make sure you have the correct maven configuration in ~/.m2/settings.xml From Camel 2.10 onwards we will require to use Maven [3.0.2,3.1.0) From Camel 2.11 onwards we will require to use Maven [3.0.4,3.1.0] You may want to get familiar with the release settings in the parent apache POM. Make sure you have installed Prince to be able to generate the Camel manual Add your Prince installation bin directory to your PATH variable: PATH=$PATH:/usr/local/bin/prince Maven 2 Setup Before you deploy anything to the maven repository using Maven 2, you should configure your ~/.m2/settings.xml file so that the file permissions of the deployed artifacts are group writable. If you do not do this, other developers will not able to overwrite your SNAPSHOT releases with newer versions. The settings follow the guidelines used by the Maven project. Please pay particular attention to the password encryption recommendations. ... apache.snapshots.https apache.website 664 775 apache.releases.https stagingSite 664 775 ... apache-release false false ... It is also essential that you configure your umask to 2 on people.apache.org for non-interactive login. You can do that by including the snipped below in your .profile. umask 002 Creating the Camel Release The release plugin will prompt for a release version, tag and next release version. Use a three digit release version of the form: 2.x.x and for the tag use a string of the form: camel-2.x.x. The next version string should use the two digit from: 2.x-SNAPSHOT as this can be consistent for future SNAPSHOT releases. Grab the latest source from Git git clone https://git-wip-us.apache.org/repos/asf/camel.git cd camel Verify headers with rat mvn -e org.apache.rat:apache-rat-plugin:check grep -e ' !?' target/rat.txt -- will show any files without licenses Because of MRELEASE-812, you should use the following setting: LANG='en_US.UTF-8' Do a release dry run to check for problems mvn release:prepare -DdryRun=true Check that you are happy with the results. The poms for the proposed tags will be in pom.xml.tag. Check also the generated signature files: cmueller$ gpg camel-core/target/camel-core-2.7.5-SNAPSHOT.jar.asc gpg: Signature made Tue Jan 10 20:50:27 2012 CET using RSA key ID 2A239C2C gpg: Good signature from "Christian Mueller (CODE SIGNING KEY) " When you like the results, clean up: mvn release:clean Prepare the release mvn release:prepare This will create the tag in svn and leave various stuff around locally to direct the perform phase. Note: If you're located in Europe then release:prepare may fail with 'Unable to tag SCM' and 'svn: No such revision X'. Wait 10 seconds and run mvn release:prepare again. Perform the release to the staging repo mvn release:perform Close the staging repository Quote from the Maven release guide for Apache projects Login to https://repository.apache.org using your Apache LDAP credentials. Click on "Staging Repositories". Then select "org.apache.camel-xxx" in the
[CONF] Apache Camel > FTP2
FTP2 Page edited by willem jiang Comment: CAMEL-6653 Changes (1) ... | {{privateKeyFilePassphrase}} | {{null}} | *SFTP only:* *Deprecated:* use {{privateKeyPassphrase}} instead. Set the private key file passphrase to that the SFTP endpoint can do private key verification. | | {{privateKeyPassphrase}} | {{null}} | *SFTP only:* *Camel 2.11.1:* Set the private key file passphrase to that the SFTP endpoint can do private key verification. | | {{preferredAuthentications}} | {{null}} | *SFTP only:* *Camel 2.10.7, 2.11.2,2.12.0:* set the preferred authentications which SFTP endpoint will used. Some example include:password,publickey. If not specified the default list from JSCH will be used. | | {{ciphers}} | {{null}} | *Camel 2.8.2, 2.9: SFTP only* Set a comma separated list of ciphers that will be used in order of preference. Possible cipher names are defined by [JCraft JSCH|http://www.jcraft.com/jsch/]. Some examples include: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc. If not specified the default list from JSCH will be used. | | {{fastExistsCheck}} | {{false}} | *Camel 2.8.2, 2.9:* If set this option to be true, camel-ftp will use the list file directly to check if the file exists. Since some FTP server may not support to list the file directly, if the option is false, camel-ftp will use the old way to list the directory and check if the file exists. Note from *Camel 2.10.1* onwards this option also influences {{readLock=changed}} to control whether it performs a fast check to update file information or not. This can be used to speed up the process if the FTP server has a lot of files. | ... Full Content FTP/SFTP/FTPS Component This component provides access to remote file systems over the FTP and SFTP protocols. Maven users will need to add the following dependency to their pom.xml for this component: org.apache.camel camel-ftp x.x.x More optionsSee File for more options as all the options from File is inherited. Consuming from remote FTP serverMake sure you read the section titled Default when consuming files further below for details related to consuming files. URI format ftp://[username@]hostname[:port]/directoryname[?options] sftp://[username@]hostname[:port]/directoryname[?options] ftps://[username@]hostname[:port]/directoryname[?options] Where directoryname represents the underlying directory. Can contain nested folders. If no username is provided, then anonymous login is attempted using no password. If no port number is provided, Camel will provide default values according to the protocol (ftp = 21, sftp = 22, ftps = ). You can append query options to the URI in the following format, ?option=value&option=value&... This component uses two different libraries for the actual FTP work. FTP and FTPS uses Apache Commons Net while SFTP uses JCraft JSCH. The FTPS component is only available in Camel 2.2 or newer. FTPS (also known as FTP Secure) is an extension to FTP that adds support for the Transport Layer Security (TLS) and the Secure Sockets Layer (SSL) cryptographic protocols. URI Options The options below are exclusive for the FTP component. More optionsSee File for more options as all the options from File is inherited. Name Default Value Description username null Specifies the username to use to log in to the remote file systen. password null Specifies the password to use to log in to the remote file system. binary false Specifies the file transfer mode, BINARY or ASCII. Default is ASCII (false). disconnect false Camel 2.2: Whether or not to disconnect from remote FTP server right after use. Can be used for both consumer and producer. Disconnect will only disconnect the current connection to the FTP server. If you have a consumer which you want to stop, then you need to stop the consumer/route instead. localWorkDirectory null When consuming, a local work directory can be used to store the remote file content directly in local files, to avoid loading the content into memory. This is beneficial, if you consume a very big remote file and thus can conserve memory. See below for more details. passiveMode false FTP and FTPS only: Specifies whether to use passive mode connections. Default is active mode (false). securityProtocol TLS FTPS only: Sets the underlying security protocol. The following values are defined: TLS: Transport Layer Security SSL: Secure Sockets Layer disableSecureDataChannelDefaults false Camel 2.4: FTPS only: Whether or not to disable using default values for execPbsz and execProt when using secure data transfer. You can set this option to t
[CONF] Apache Camel > Crypto (Digital Signatures)
Crypto (Digital Signatures) Page edited by Colm O hEigeartaigh Changes (2) ... | {{keystore}} | {{KeyStore}} | {{null}} | A reference to a JCE Keystore that stores keys and certificates used to sign and verify. | | {{provider}} | {{String}} | {{null}} | The name of the JCE Security Provider that should be used. | | {{privateKey}} | {{PrivateKey}} | {{null}} | The private key used to sign the exchange's payload. | | {{publicKey}} | {{PublicKey}} | {{null}} | The public key used to verify the signature of the exchange's payload. | | {{secureRandom}} | {{secureRandom}} | {{null}} | A reference to a {{SecureRandom}} object that will be used to initialize the Signature service. | ... {snippet:id=provider|lang=xml|url="" h4. 4) Changing the Signature Mesasge Message Header It may be desirable to change the message header used to store the signature. A different header name can be specified in the route definition as follows {snippet:id=signature-header|lang=java|url="" ... Full Content Crypto component for Digital Signatures Available as of Camel 2.3 With Camel cryptographic endpoints and Java's Cryptographic extension it is easy to create Digital Signatures for Exchanges. Camel provides a pair of flexible endpoints which get used in concert to create a signature for an exchange in one part of the exchange's workflow and then verify the signature in a later part of the workflow. Maven users will need to add the following dependency to their pom.xml for this component: org.apache.camel camel-crypto x.x.x Introduction Digital signatures make use of Asymmetric Cryptographic techniques to sign messages. From a (very) high level, the algorithms use pairs of complimentary keys with the special property that data encrypted with one key can only be decrypted with the other. One, the private key, is closely guarded and used to 'sign' the message while the other, public key, is shared around to anyone interested in verifying the signed messages. Messages are signed by using the private key to encrypting a digest of the message. This encrypted digest is transmitted along with the message. On the other side the verifier recalculates the message digest and uses the public key to decrypt the the digest in the signature. If both digests match the verifier knows only the holder of the private key could have created the signature. Camel uses the Signature service from the Java Cryptographic Extension to do all the heavy cryptographic lifting required to create exchange signatures. The following are some excellent resources for explaining the mechanics of Cryptography, Message digests and Digital Signatures and how to leverage them with the JCE. Bruce Schneier's Applied Cryptography Beginning Cryptography with Java by David Hook The ever insightful Wikipedia Digital_signatures URI format As mentioned Camel provides a pair of crypto endpoints to create and verify signatures crypto:sign:name[?options] crypto:verify:name[?options] crypto:sign creates the signature and stores it in the Header keyed by the constant Exchange.SIGNATURE, i.e. "CamelDigitalSignature". crypto:verify will read in the contents of this header and do the verification calculation. In order to correctly function, the sign and verify process needs a pair of keys to be shared, signing requiring a PrivateKey and verifying a PublicKey (or a Certificate containing one). Using the JCE it is very simple to generate these key pairs but it is usually most secure to use a KeyStore to house and share your keys. The DSL is very flexible about how keys are supplied and provides a number of mechanisms. Note a crypto:sign endpoint is typically defined in one route and the complimentary crypto:verify in another, though for simplicity in the examples they appear one after the other. It goes without saying that both signing and verifying should be configured identically. Options Name Type Default Description algorithm String DSA The name of the JCE Signature algorithm that will be used. alias String null An alias name that will be used to select a key from the keystore. bufferSize Integer 2048 the size of the buffer used in the signature process. certificate Certificate null A Certificate used to verify the signature of the exchange's payload. Either this or a Public Key is required. keystore KeyStore null A reference to a JCE Keystore that stores keys and certificates used to sign and verify. provider String null The name of the JCE Security Provider that should be used. privateKey PrivateKey null The private key used to sign th
git commit: CAMEL-5880: Removed the hack of forking always as the weired OOM caused by QuickfixjSpringTest is not given anymore.
Updated Branches: refs/heads/master fe601a969 -> 7cbedb6b2 CAMEL-5880: Removed the hack of forking always as the weired OOM caused by QuickfixjSpringTest is not given anymore. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7cbedb6b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7cbedb6b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7cbedb6b Branch: refs/heads/master Commit: 7cbedb6b26e424876dfb1e43ba6e68b859452452 Parents: fe601a9 Author: Babak Vahdat Authored: Wed Aug 21 15:39:25 2013 +0200 Committer: Babak Vahdat Committed: Wed Aug 21 15:39:25 2013 +0200 -- components/camel-quickfix/pom.xml | 17 - 1 file changed, 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/7cbedb6b/components/camel-quickfix/pom.xml -- diff --git a/components/camel-quickfix/pom.xml b/components/camel-quickfix/pom.xml index 390d151..914bd5e 100644 --- a/components/camel-quickfix/pom.xml +++ b/components/camel-quickfix/pom.xml @@ -79,23 +79,6 @@ - - - - -maven-surefire-plugin - - - always - - - - -
[CONF] Apache Camel > Camel 2.12.0 Release
Camel 2.12.0 Release Page edited by Claus Ibsen Changes (1) ... * [MyBatis Example] * [Netty HTTP Server Example] * {{camel-example-jdbc}} - An example using [JDBC] component with an embedded database * {{camel-example-restlet-jdbc}} - An example using [Restlet] and [JDBC] with an embedded database h3. New [Tutorials] ... Full Content Camel 2.12.0 release (currently in progress) New and Noteworthy Welcome to the 2.12.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) Endpoint Annotations along with automatically created HTML documentation for the endpoint parameters; this makes it easier for component developers to add a few refactoring-safe annotations to their Endpoint or Consumer implementations and, (along with javadoc comments on the field or setter method), get nice user documentation on how to use the endpoint for free. ComponentConfiguration API provides a handy API for tools developers to introspect on a Component to find all the possible parameters, their types and any extra annotations (like Bean Validation Annotations) to be able to create/edit endpoints or URI strings so that tools can generate nicer UIs for configuring endpoints than just letting folks edit Strings. EndpointCompleter API provides a hook so that command line tools (like Karaf's shell), IDEs and web tools can get (bash tab like) auto-completion on endpoint paths (such as file or directory names, message queue names, database table names) when creating or using new endpoints Reduced stack-frames in use during routing, that also makes Camel's stack traces being logged much less verbose. This also allows people to easier debug the internals of Camel as less AsyncCallback callbacks are in use during routing. Easy to use Message History out of the box. And included message history as "route stack-trace" when exceptions logged by Error Handler to make it easier for end users to spot where the exception occurred. Spring Web Services now supports setting/receiving SOAP headers more easily using a header on the Camel Message. Evaluating Groovy expressions is faster as we cache the compiled scripts. Added base64 option to Shiro Security to allow transferring security token over JMS and other transports as base64 encoded representation. Made it easier to use Shiro Security as the credentials can be provided in headers, when sending a message to a secured route. Bindy now supports enums. Added new BacklogDebugger to perform live debugging of messages during routing. The BacklogDebugger has JMX API allows tooling to control the debugger. While using the Jackson library through the JSON Dataformat there's now a jsonView attribute you could make use of directly inside the DSL itself. SMPP now supports optional parameters in all commands where they are possible. JDBC now supports named parameters. Added timeout support for Direct producers to wait for consumer to become active. Added stats action to ControlBus to easily get performance statics in a single XML message. Added support for request timeout on Netty producer, and to configure logging level on Netty consumer to be less noisy for ChannelClosedException which can flood the logs when client disconnects abruptly. Spring Batch component producer now returns the JobExecution instance as the output message. Users can use the JobExecution instance to perform some operations using the Spring Batch API directly. Added support for NULL values in SQL with named parameters. Optimized Jetty streaming responses in non-chunked mode; and as well using buffer sizes based on HttpServletResponse.getBufferSize() instead of fixed size of 4kb. Added greedy option to scheduled polling consumer. Added support for accessing the length field on Java arrays in Simple language. Added support for using JAXB annotations with Camel's Jackson JSON component. Added the ability for Bindy to skip content when parsing fixed-length records. MongoDB now supports aggregation queries. Netty allows to use shared Netty boss and worker thread pools. The Camel Maven Archetypes for component and data format now packages as OSGi bundles out of the box. Easier Stream caching configuration using StreamCachingStrategy. Also allows spool directory per CamelContext instead of shared per JVM. And insight at runtime using JMX management. As well allowing to plugin 3rd party implementations. Improved Netty to be able to join an UDP multicast group. Using Camel Spring is now setting up Camel routes later in the process allow Spring to complete all of its dependency injection, before Camel RouteBuilder instances is configured. This allows to safely use Spring dependency injection in these
git commit: CAMEL-3096: an example using JDBC component. Thanks to Zemian Deng for the contribution.
Updated Branches: refs/heads/master f93b1fa59 -> fe601a969 CAMEL-3096: an example using JDBC component. Thanks to Zemian Deng for the contribution. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fe601a96 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fe601a96 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fe601a96 Branch: refs/heads/master Commit: fe601a9691ce2dd709199fa8654142a86d636e95 Parents: f93b1fa Author: Claus Ibsen Authored: Wed Aug 21 15:32:31 2013 +0200 Committer: Claus Ibsen Committed: Wed Aug 21 15:32:31 2013 +0200 -- examples/camel-example-jdbc/README.txt | 43 examples/camel-example-jdbc/pom.xml | 84 .../camel/example/jdbc/RecordProcessor.java | 39 .../src/main/resources/META-INF/LICENSE.txt | 203 +++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../resources/META-INF/spring/camel-context.xml | 101 + .../src/main/resources/create-derby.sql | 9 + .../src/main/resources/log4j.properties | 31 +++ examples/pom.xml| 1 + 9 files changed, 522 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/fe601a96/examples/camel-example-jdbc/README.txt -- diff --git a/examples/camel-example-jdbc/README.txt b/examples/camel-example-jdbc/README.txt new file mode 100644 index 000..8ddab78 --- /dev/null +++ b/examples/camel-example-jdbc/README.txt @@ -0,0 +1,43 @@ +Camel JDBC Example +== + +This example shows how to use camel-jdbc component with an embedded +Apache Derby database. + +This example uses Spring to setup and configure the database, +as well the CamelContext. + +You can see this in the following file: + - src/main/resources/META-INF/spring/camel-context.xml + +The spring config setups three routes as follow: + + sample-generator-route + This route will generate sample data into database upon Camel starts. + + query-update-route-part1/query-update-route-part2 + These two are connected together. It first query the database for + NEW record to be process, invoke RecordProcess bean to do the work, + then update the record as DONE so not to re-process on next polled. + +Standalone +-- +First compile this example: + mvn compile + +Now to run the example type + mvn camel:run + +To stop the example hit ctrl + c + +Help + + +If you hit any problems please talk to us on the Camel Forums + http://camel.apache.org/discussion-forums.html + +Please help us make Apache Camel better - we appreciate any feedback you +may have. Enjoy! + + +The Camel riders! http://git-wip-us.apache.org/repos/asf/camel/blob/fe601a96/examples/camel-example-jdbc/pom.xml -- diff --git a/examples/camel-example-jdbc/pom.xml b/examples/camel-example-jdbc/pom.xml new file mode 100644 index 000..c88e995 --- /dev/null +++ b/examples/camel-example-jdbc/pom.xml @@ -0,0 +1,84 @@ + + +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> + + 4.0.0 + + +org.apache.camel +examples +2.12-SNAPSHOT + + + camel-example-jdbc + bundle + Camel :: Example :: JDBC + An example for showing Camel using JDBC component + + + org.apache.camel.example.jdbc.* + +* + + + + + + + org.apache.camel + camel-spring + + + org.apache.camel + camel-jdbc + + + org.springframework + spring-jdbc + + + + + org.apache.derby + derby + + + commons-dbcp + commons-dbcp + + + + + org.slf4j + slf4j-log4j12 + + + + + + + + +org.apache.camel +camel-maven-plugin +${project.version} + + + + + http://git-wip-us.apache.org/repos/asf/camel/blob/fe601a96/examples/camel-example-jdbc/src/main/java/org/apache/camel/example/jdbc/RecordProcessor.java -- diff --git a/examples/camel-example-jdbc/src/main/java/org/apache/camel/example/jdbc/RecordProcessor.java b/examples/camel-example-jdbc/src/main/java/org/apache/camel/example/jdbc/RecordProcessor.java new file mode 100644 index 000..7a1f83c --- /dev/null +++ b/examples/camel-example-jdbc/src/main/java/org/apache/camel/example/jdbc/RecordProcessor.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license
svn commit: r875585 - in /websites/production/camel/content: cache/main.pageCache camel-2120-release.html
Author: buildbot Date: Wed Aug 21 13:19:08 2013 New Revision: 875585 Log: Production update by buildbot for camel Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/camel-2120-release.html Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/camel-2120-release.html == --- websites/production/camel/content/camel-2120-release.html (original) +++ websites/production/camel/content/camel-2120-release.html Wed Aug 21 13:19:08 2013 @@ -94,7 +94,7 @@ Welcome to the 2.12.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) -Endpoint Annotations along with automatically created HTML documentation for the endpoint parameters; this makes it easier for component developers to add a few refactoring-safe annotations to their Endpoint or Consumer implementations and, (along with javadoc comments on the field or setter method), get nice user documentation on how to use the endpoint for free.ComponentConfiguration API provides a handy API for tools developers to introspect on a Component to find all the possible parameters, their types and any extra annotations (like Bean Validation Annotations) to be able to create/edit endpoints or URI strings so that tools can generate nicer UIs for configuring endpoints than just letting folks edit Strings.Endpoi ntCompleter API provides a hook so that command line tools (like http://karaf.apache.org/manual/latest-2.3.x/users-guide/using-console.html";>Karaf's shell), IDEs and web tools can get (bash tab like) auto-completion on endpoint paths (such as file or directory names, message queue names, database table names) when creating or using new endpointsReduced stack-frames in use during routing, that also makes Camel's stack traces being logged much less verbose. This also allows people to easier debug the internals of Camel as less AsyncCallback callbacks are in use during routing.Easy to use Message History out of the box. And included message history as "route stack-trace" when exceptions logged by Error Handler to make it easier for end users to spot where the exception o ccurred.Spring Web Services now supports setting/receiving SOAP headers more easily using a header on the Camel Message.Evaluating Groovy expressions is faster as we cache the compiled scripts.Added base64 option to Shiro Security to allow transferring security token over JMS and other transports as base64 encoded representation.Made it easier to use Shiro Security as the credentials can be provided in headers, when sending a message to a secured route.Bindy now supports enums.Added new BacklogDebugger to perform live debugging of messages during routing. The BacklogDebugger has JMX API allows tooling to control the debugger.While using the http://xircles.codehaus.org/projects/jackson"; rel="nofollow">Jackson library through the JSON Dataformat there's now a jsonView attribute you could make use of directly inside the DSL itself.SMPP now supports optional parameters in all commands where they are possible.JDBC now supports named parameters.Added timeout support for Direct producers to wait for cons umer to become active.Added stats action to ControlBus to easily get performance statics in a single XML message.Added support for request timeout on Netty producer, and to configure logging level on Netty consumer to be less noisy for ChannelClosedException which can flood the logs when client disconnects abruptly.Spring Batch component producer now returns the JobExecution instance as the output message. Users can use the JobExecution instance to perform some operations using the Spring Batch API directly.Added support for NULL values in SQL with named parameters.Optimized Jetty streaming responses in non-chunked mode; and as well using buffer sizes based on HttpServletResponse.getBufferSize() instead of fixed size of 4kb.Added greedy option to scheduled polling consumer.Added support for accessing the length field on Java arrays in Simple language.Added support for using JAXB annotations with Camel's Jackson JSON component.Added the ability for Bindy to skip content when parsing fixed-length records.MongoDB now supports aggregation queries.Netty allows to use shared Netty boss and worker thread pools.The Camel Maven Archetypes for component and data format now packages as OSGi bundles out of the box.Easier Stream caching configuration using StreamCachingStrategy. Also allows spool directory per CamelContext instead of shared per JVM. And insight at runtime using JMX management. As well allowing to plugin 3rd party implementations.Improved Netty to be able to join an UDP multicast group.Using Camel Spring i
[CONF] Apache Camel > Camel 2.12.0 Release
Camel 2.12.0 Release Page edited by Claus Ibsen Changes (1) ... * [Netty] consumer now unbinds/binds the acceptor when the route is suspended/resumed. * [EIP]s supporting {{AggregationStrategy}} such as [Aggregate|Aggregator2], [Splitter], [Content Enricher] now supports using a POJO as the {{AggregationStrategy}}, which allows to implement the aggregate logic with no Camel API dependency. See more details at the [Aggregate|Aggregator2] page. * {{camel-jpa}} upgraded to use native JPA API instead of Springs deprecated JpaTemplate h3. Fixed Issues ... Full Content Camel 2.12.0 release (currently in progress) New and Noteworthy Welcome to the 2.12.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) Endpoint Annotations along with automatically created HTML documentation for the endpoint parameters; this makes it easier for component developers to add a few refactoring-safe annotations to their Endpoint or Consumer implementations and, (along with javadoc comments on the field or setter method), get nice user documentation on how to use the endpoint for free. ComponentConfiguration API provides a handy API for tools developers to introspect on a Component to find all the possible parameters, their types and any extra annotations (like Bean Validation Annotations) to be able to create/edit endpoints or URI strings so that tools can generate nicer UIs for configuring endpoints than just letting folks edit Strings. EndpointCompleter API provides a hook so that command line tools (like Karaf's shell), IDEs and web tools can get (bash tab like) auto-completion on endpoint paths (such as file or directory names, message queue names, database table names) when creating or using new endpoints Reduced stack-frames in use during routing, that also makes Camel's stack traces being logged much less verbose. This also allows people to easier debug the internals of Camel as less AsyncCallback callbacks are in use during routing. Easy to use Message History out of the box. And included message history as "route stack-trace" when exceptions logged by Error Handler to make it easier for end users to spot where the exception occurred. Spring Web Services now supports setting/receiving SOAP headers more easily using a header on the Camel Message. Evaluating Groovy expressions is faster as we cache the compiled scripts. Added base64 option to Shiro Security to allow transferring security token over JMS and other transports as base64 encoded representation. Made it easier to use Shiro Security as the credentials can be provided in headers, when sending a message to a secured route. Bindy now supports enums. Added new BacklogDebugger to perform live debugging of messages during routing. The BacklogDebugger has JMX API allows tooling to control the debugger. While using the Jackson library through the JSON Dataformat there's now a jsonView attribute you could make use of directly inside the DSL itself. SMPP now supports optional parameters in all commands where they are possible. JDBC now supports named parameters. Added timeout support for Direct producers to wait for consumer to become active. Added stats action to ControlBus to easily get performance statics in a single XML message. Added support for request timeout on Netty producer, and to configure logging level on Netty consumer to be less noisy for ChannelClosedException which can flood the logs when client disconnects abruptly. Spring Batch component producer now returns the JobExecution instance as the output message. Users can use the JobExecution instance to perform some operations using the Spring Batch API directly. Added support for NULL values in SQL with named parameters. Optimized Jetty streaming responses in non-chunked mode; and as well using buffer sizes based on HttpServletResponse.getBufferSize() instead of fixed size of 4kb. Added greedy option to scheduled polling consumer. Added support for accessing the length field on Java arrays in Simple language. Added support for using JAXB annotations with Camel's Jackson JSON component. Added the ability for Bindy to skip content when parsing fixed-length records. MongoDB now supports aggregation queries. Netty allows to use shared Netty boss and worker thread pools. The Camel Maven Archetypes for component and data format now packages as OSGi bundles out of the box. Easier Stream caching configuration using StreamCachingStrategy. Also allows spool directory per CamelContext instead of shared per JVM. And insight at runtime using JMX management. As well allowing to plugin 3rd party implementations. Improved Netty to be able to join an UDP multicast group. Using Cam
[3/4] git commit: CAMEL-5932 updated consumer and producer for direct EntityManager usage
CAMEL-5932 updated consumer and producer for direct EntityManager usage Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1efc537f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1efc537f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1efc537f Branch: refs/heads/master Commit: 1efc537f8752772f54c1e2e1ff84bf733ba1d055 Parents: 708c4cd Author: Brett Meyer Authored: Thu Aug 8 14:07:33 2013 -0400 Committer: Claus Ibsen Committed: Wed Aug 21 15:06:32 2013 +0200 -- .../camel/component/jpa/JpaConstants.java | 2 +- .../apache/camel/component/jpa/JpaConsumer.java | 28 -- .../apache/camel/component/jpa/JpaEndpoint.java | 45 +- .../apache/camel/component/jpa/JpaProducer.java | 31 --- .../jpa/JpaTemplateTransactionStrategy.java | 89 .../component/jpa/TransactionStrategy.java | 33 .../idempotent/jpa/JpaMessageIdRepository.java | 54 +++- 7 files changed, 96 insertions(+), 186 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1efc537f/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java index ed5b922..3e42d9f 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java @@ -23,7 +23,7 @@ package org.apache.camel.component.jpa; */ public final class JpaConstants { -public static final String JPA_TEMPLATE = "CamelJpaTemplate"; +public static final String ENTITYMANAGER = "CamelEntityManager"; private JpaConstants() { // utility class http://git-wip-us.apache.org/repos/asf/camel/blob/1efc537f/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java index 5f81041..10cdd2d 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java @@ -36,7 +36,9 @@ import org.apache.camel.util.CastUtils; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.orm.jpa.JpaCallback; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionCallback; +import org.springframework.transaction.support.TransactionTemplate; /** * @version @@ -45,7 +47,8 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer { private static final Logger LOG = LoggerFactory.getLogger(JpaConsumer.class); private final JpaEndpoint endpoint; -private final TransactionStrategy template; + private final EntityManager entityManager; +private final TransactionTemplate transactionTemplate; private QueryFactory queryFactory; private DeleteHandler deleteHandler; private String query; @@ -66,7 +69,8 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer { public JpaConsumer(JpaEndpoint endpoint, Processor processor) { super(endpoint, processor); this.endpoint = endpoint; -this.template = endpoint.createTransactionStrategy(); +this.entityManager = endpoint.createEntityManager(); +this.transactionTemplate = endpoint.createTransactionTemplate(); } @Override @@ -75,9 +79,11 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer { shutdownRunningTask = null; pendingExchanges = 0; -Object messagePolled = template.execute(new JpaCallback() { -public Object doInJpa(EntityManager entityManager) throws PersistenceException { -Queue answer = new LinkedList(); +Object messagePolled = transactionTemplate.execute(new TransactionCallback() { +public Object doInTransaction(TransactionStatus status) { + entityManager.joinTransaction(); + + Queue answer = new LinkedList(); Query query = getQueryFactory().createQuery(entityManager); configureParameters(query); @@ -374,7 +380,15 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer { protected Exchange createExchange(Object result) { Exchange
[4/4] git commit: CAMEL-5932: Use JPA API instead of @deprecated spring jpa api.
CAMEL-5932: Use JPA API instead of @deprecated spring jpa api. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f93b1fa5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f93b1fa5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f93b1fa5 Branch: refs/heads/master Commit: f93b1fa59e385b5377dc8f9bf5293413528a2457 Parents: a27d5e9 Author: Claus Ibsen Authored: Wed Aug 21 14:30:01 2013 +0200 Committer: Claus Ibsen Committed: Wed Aug 21 15:06:33 2013 +0200 -- components/camel-jpa/pom.xml| 9 ++-- .../apache/camel/component/jpa/JpaEndpoint.java | 2 +- .../apache/camel/component/jpa/JpaProducer.java | 10 +++-- .../component/jpa/AbstractJpaMethodTest.java| 46 +++- .../camel/component/jpa/JpaUseMergeTest.java| 7 +-- .../camel/component/jpa/JpaUsePersistTest.java | 26 ++- .../jpa/JpaWithNamedQueryAndParametersTest.java | 24 +- .../camel/processor/jpa/AbstractJpaTest.java| 4 +- .../jpa/JpaProducerConcurrentTest.java | 3 +- .../src/test/resources/META-INF/persistence.xml | 4 ++ .../resources/META-INF/spring/camel-context.xml | 9 +--- 11 files changed, 68 insertions(+), 76 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f93b1fa5/components/camel-jpa/pom.xml -- diff --git a/components/camel-jpa/pom.xml b/components/camel-jpa/pom.xml index 632480e..23d2a80 100644 --- a/components/camel-jpa/pom.xml +++ b/components/camel-jpa/pom.xml @@ -58,10 +58,6 @@ org.springframework - spring-jdbc - - - org.springframework spring-orm @@ -77,6 +73,11 @@ test + org.springframework + spring-jdbc + test + + org.apache.openjpa openjpa-persistence-jdbc test http://git-wip-us.apache.org/repos/asf/camel/blob/f93b1fa5/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java index e99c405..dc17d3f 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java @@ -305,6 +305,6 @@ public class JpaEndpoint extends ScheduledPollEndpoint { @Override protected void doStop() throws Exception { super.doStop(); -entityManager.close(); +//entityManager.close(); } } http://git-wip-us.apache.org/repos/asf/camel/blob/f93b1fa5/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java index c83f0a6..0f9576a 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java @@ -53,7 +53,7 @@ public class JpaProducer extends DefaultProducer { transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { entityManager.joinTransaction(); - + if (values.getClass().isArray()) { Object[] array = (Object[]) values; for (int index = 0; index < array.length; index++) { @@ -82,6 +82,8 @@ public class JpaProducer extends DefaultProducer { } if (endpoint.isFlushOnSend()) { +// there may be concurrency so need to join tx before flush +entityManager.joinTransaction(); entityManager.flush(); } @@ -90,16 +92,16 @@ public class JpaProducer extends DefaultProducer { /** * save the given entity end return the managed entity - * - * @param entity - * @param entityManager * @return the managed entity */ private Object save(final Object entity, EntityManager entityManager) { +// there may be concurrency so need to join tx before persist/merge if (endpoint.isUsePersist()) { +
[1/4] git commit: CAMEL-5932 share an EntityManager in the entire endpoint and corrected a few test failures
Updated Branches: refs/heads/master 708c4cd87 -> f93b1fa59 CAMEL-5932 share an EntityManager in the entire endpoint and corrected a few test failures Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a27d5e9b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a27d5e9b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a27d5e9b Branch: refs/heads/master Commit: a27d5e9bccd1acb95873af9fa815e05a790d3c86 Parents: e696c60 Author: Brett Meyer Authored: Thu Aug 8 15:34:56 2013 -0400 Committer: Claus Ibsen Committed: Wed Aug 21 15:06:32 2013 +0200 -- .../apache/camel/component/jpa/JpaConsumer.java | 10 + .../apache/camel/component/jpa/JpaEndpoint.java | 14 ++- .../apache/camel/component/jpa/JpaProducer.java | 8 +--- .../component/jpa/AbstractJpaMethodTest.java| 3 +- .../org/apache/camel/component/jpa/JpaTest.java | 3 +- .../component/jpa/JpaWithNamedQueryTest.java| 3 +- .../interceptor/JpaTraceEventMessageTest.java | 41 +++- 7 files changed, 39 insertions(+), 43 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a27d5e9b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java index 10cdd2d..a4a73e4 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java @@ -69,7 +69,7 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer { public JpaConsumer(JpaEndpoint endpoint, Processor processor) { super(endpoint, processor); this.endpoint = endpoint; -this.entityManager = endpoint.createEntityManager(); +this.entityManager = endpoint.getEntityManager(); this.transactionTemplate = endpoint.createTransactionTemplate(); } @@ -383,12 +383,4 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer { exchange.getIn().setHeader(JpaConstants.ENTITYMANAGER, entityManager); return exchange; } - -@Override -protected void doStop() throws Exception { -super.doStop(); -// TODO: This should probably happen, but hitting an open transaction or flush in progress. -// Is there a thread holding onto it? -//entityManager.close(); -} } http://git-wip-us.apache.org/repos/asf/camel/blob/a27d5e9b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java index cee83f2..e99c405 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java @@ -43,6 +43,7 @@ public class JpaEndpoint extends ScheduledPollEndpoint { private EntityManagerFactory entityManagerFactory; private PlatformTransactionManager transactionManager; +private EntityManager entityManager; private String persistenceUnit = "camel"; private Expression producerExpression; private int maximumResults = -1; @@ -262,8 +263,11 @@ public class JpaEndpoint extends ScheduledPollEndpoint { return tm; } -protected EntityManager createEntityManager() { -return getEntityManagerFactory().createEntityManager(); +protected EntityManager getEntityManager() { +if (entityManager == null) { + entityManager = getEntityManagerFactory().createEntityManager(); +} +return entityManager; } protected TransactionTemplate createTransactionTemplate() { @@ -297,4 +301,10 @@ public class JpaEndpoint extends ScheduledPollEndpoint { } }; } + +@Override +protected void doStop() throws Exception { +super.doStop(); +entityManager.close(); +} } http://git-wip-us.apache.org/repos/asf/camel/blob/a27d5e9b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java -- diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java index c06a1b8..c83f0a6 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component
git commit: avoid possible hang or crash if we try and complete on a component which is not active and hasn't been configured. Also provide an API to lookup components which are active (to avoid forci
Updated Branches: refs/heads/master a87a8d129 -> 708c4cd87 avoid possible hang or crash if we try and complete on a component which is not active and hasn't been configured. Also provide an API to lookup components which are active (to avoid forcing lazy create) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/708c4cd8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/708c4cd8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/708c4cd8 Branch: refs/heads/master Commit: 708c4cd87e3e2cdc0922749e4ab1a660d5337291 Parents: a87a8d1 Author: James Strachan Authored: Wed Aug 21 12:11:40 2013 +0100 Committer: James Strachan Committed: Wed Aug 21 12:11:40 2013 +0100 -- .../src/main/java/org/apache/camel/CamelContext.java| 10 ++ .../java/org/apache/camel/impl/DefaultCamelContext.java | 4 .../camel/management/mbean/ManagedCamelContext.java | 12 3 files changed, 22 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/708c4cd8/camel-core/src/main/java/org/apache/camel/CamelContext.java -- diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java b/camel-core/src/main/java/org/apache/camel/CamelContext.java index 64f4d7a..d8f7894 100644 --- a/camel-core/src/main/java/org/apache/camel/CamelContext.java +++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java @@ -248,6 +248,16 @@ public interface CamelContext extends SuspendableService, RuntimeConfiguration { Component getComponent(String componentName); /** + * Gets a component from the context by name. + * + * @param componentName the name of the component + * @param autoCreateComponents whether or not the component should + * be lazily created if it does not already exist + * @return the component + */ +Component getComponent(String name, boolean autoCreateComponents); + +/** * Gets a component from the context by name and specifying the expected type of component. * * @param name the name to lookup http://git-wip-us.apache.org/repos/asf/camel/blob/708c4cd8/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java index 7dd64de..9fe8bb1 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java @@ -331,6 +331,10 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon } public Component getComponent(String name) { +return getComponent(name, autoCreateComponents); +} + +public Component getComponent(String name, boolean autoCreateComponents) { // synchronize the look up and auto create so that 2 threads can't // concurrently auto create the same component. synchronized (components) { http://git-wip-us.apache.org/repos/asf/camel/blob/708c4cd8/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java -- diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java index e643e8d..b41ff35 100644 --- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java +++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java @@ -373,10 +373,14 @@ public class ManagedCamelContext extends ManagedPerformanceCounter implements Ti if (completionText == null) { completionText = ""; } -Component component = context.getComponent(componentName); -ComponentConfiguration configuration = component.createComponentConfiguration(); -configuration.setParameters(endpointParameters); -return configuration.completeEndpointPath(completionText); +Component component = context.getComponent(componentName, false); +if (component != null) { +ComponentConfiguration configuration = component.createComponentConfiguration(); +configuration.setParameters(endpointParameters); +return configuration.completeEndpointPath(completionText); +} else { +return new ArrayList(); +} } public String componentParameterJsonSchema(String componentName) throws Exception {