[CONF] Apache Camel NMR
NMR Page moved by Claus Ibsen From: Apache Camel To: Apache Camel Components Children moved Change Notification Preferences View Online | Add Comment
[CONF] Apache Camel Component List
Component List Page edited by Claus Ibsen Component / ArtifactId / URI Description ActiveMQ / activemq-camel activemq:[topic:]destinationName For JMS Messaging with Apache ActiveMQ ActiveMQ Journal / activemq-core activemq.journal:directory-on-filesystem Uses ActiveMQ's fast disk journaling implementation to store message bodies in a rolling log file AMQP / camel-amqp amqp:[topic:]destinationName For Messaging with AMQP protocol Atom / camel-atom atom:uri Working with Apache Abdera for atom integration, such as consuming an atom feed. Bean / camel-core bean:beanName[?method=someMethod] Uses the Bean Binding to bind message exchanges to beans in the Registry. Is also used for exposing and invoking POJO (Plain Old Java Objects). Browse / camel-core browse:someName Provdes a simple BrowsableEndpoint which can be useful for testing, visualisation tools or debugging. The exchanges sent to the endpoint are all available to be browsed. Cache / camel-cache cache://cachename[?options] The cache component facilitates creation of caching endpoints and processors using EHCache as the cache implementation. Cometd / camel-cometd cometd://host:port/channelname Used to deliver messages using the jetty cometd implementation of the bayeux protocol CXF / camel-cxf cxf:address[?serviceClass=...] Working with Apache CXF for web services integration CXFRS / camel-cxf cxfrs:address[?resourcesClasses=...] Working with Apache CXF for REST services integration DataSet / camel-core dataset:name For load soak testing the DataSet provides a way to create huge numbers of messages for sending to Components or asserting that they are consumed correctly Direct / camel-core direct:name Synchronous call to another endpoint Esper / camel-esper in camel-extra esper:name Working with the Esper Library for Event Stream Processing Event / camel-spring event://default spring-event://default Working with Spring ApplicationEvents File / camel-core file://nameOfFileOrDirectory Sending messages to a file or polling a file or directory. Camel 1.x use this link File. Flatpack / camel-flatpack flatpack:[fixed|delim]:configFile Processing fixed width or delimited files or messages using the FlatPack library Freemarker / camel-freemarker freemarker:someTemplateResource Generates a response using a Freemarker template FTP / camel-ftp ftp://host[:port]/fileName Sending and receiving files over FTP. Camel 1.x use this link FTP. GHttp / camel-gae ghttp://hostname[:port][/path][?options] ghttp:///path[?options] Provides connectivity to the URL fetch service of Google App Engine but can also be used to receive messages from servlets. See also Camel Components for Google App Engine. GTask / camel-gae gtask://queue-name supports asynchronous message processing on Google App Engine by using the task queueing service as message queue. See also Camel Components for Google App Engine. GMail / camel-gae gmail://u...@gmail.com[?options] gmail://u...@googlemail.com[?options] Supports sending of emails via the mail service of Google App Engine. See also Camel Components for Google App Engine. Hibernate / camel-hibernate in camel-extra hibernate://entityName For using a database as a queue via the Hibernate library HL7 / camel-hl7 mina:tcp://hostname[:port] For working with the HL7 MLLP protocol and the HL7 model using the HAPI library HTTP / camel-http http://hostname[:port] For calling out to external HTTP servers iBATIS / camel-ibatis ibatis://sqlOperationName Performs a query, poll, insert, update or delete in a relational database using Apache iBATIS IMap / camel-mail imap://hostname[:port] Receiving email using IMap IRC / camel-irc irc:host[:port]/#room For IRC communication JavaSpace / camel-javaspace javaspace:jini://host?spaceName=mySpace?... Sending and receiving messages through JavaSpace JBI / servicemix-camel jbi:serviceName For JBI integration such as working with Apache ServiceMix JCR / camel-jcr jcr://user:passw...@repository/path/to/node Storing a message in a JCR (JSR-170) compliant repository like Apache Jackrabbit JDBC / camel-jdbc jdbc:dataSourceName?options For performing JDBC queries and operations Jetty / camel-jetty jetty:url For exposing services over HTTP JMS / camel-jms jms:[topic:]destinationName Working with JMS providers JPA / camel-jpa jpa://entityName For using a database as a queue via the JPA specification for working with OpenJPA, Hibernate or TopLink JT/400 / camel-jt400 jt400://user:p...@system/path_to_dtaq For integrating with data queues on an AS/400 (aka System i, IBM i, i5, ...) system LDAP / camel-ldap
[CONF] Apache Camel JBI
JBI Page edited by Claus Ibsen JBI Component The jbi component is implemented by the ServiceMix Camel module and provides integration with a JBI Normalized Message Router, such as the one provided by Apache ServiceMix. Using ServiceMix 4.xConsider using NMR instead of JBI for ServiceMix 4.0 onwards. See below for information about how to use StreamSource types from ServiceMix in Camel. The following code: from("jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint") Automatically exposes a new endpoint to the bus, where the service QName is {http://foo.bar.org}MyService and the endpoint name is MyEndpoint (see URIformat). When a JBI endpoint appears at the end of a route, for example: to("jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint") The messages sent by this producer endpoint are sent to the already deployed JBI endpoint. URI format jbi:service:serviceNamespace[sep]serviceName[?options] jbi:endpoint:serviceNamespace[sep]serviceName[sep]endpointName[?options] jbi:name:endpointName[?options] The separator that should be used in the endpoint URL is: / (forward slash), if serviceNamespace starts with http://, or : (colon), if serviceNamespace starts with urn:foo:bar. For more details of valid JBI URIs see the ServiceMix URI Guide. Using the jbi:service: or jbi:endpoint: URI formats sets the service QName on the JBI endpoint to the one specified. Otherwise, the default Camel JBI Service QName is used, which is: {http://activemq.apache.org/camel/schema/jbi}endpoint You can append query options to the URI in the following format, ?option=valueoption=value... Examples jbi:service:http://foo.bar.org/MyService jbi:endpoint:urn:foo:bar:MyService:MyEndpoint jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint jbi:name:cheese URI options Name Default value Description mep MEP of the Camel Exchange Allows users to override the MEP set on the Exchange object. Valid values for this option are in-only, in-out, robust-in-out and in-optional-out. operation Value of the jbi.operation header property Specifies the JBI operation for the MessageExchange. If no value is supplied, the JBI binding will use the value of the jbi.operation header property. serialization basic Default value (basic) will check if headers are serializable by looking at the type, setting this option to strict will detect objects that can not be serialized although they implement the Serializable interface convertException false false: send any exceptions thrown from the Camel route back unmodified true: convert all exceptions to a JBI FaultException (can be used to avoid non-serializable exceptions or to implement generic error handling Examples jbi:service:http://foo.bar.org/MyService?mep=in-out (override the MEP, use InOut JBI MessageExchanges) jbi:endpoint:urn:foo:bar:MyService:MyEndpoint?mep=in (override the MEP, use InOnly JBI MessageExchanges) jbi:endpoint:urn:foo:bar:MyService:MyEndpoint?operation={http://www.mycompany.org}AddNumbers (overide the operation for the JBI Exchange to {http://www.mycompany.org}AddNumbers) Using Stream bodies If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable DEBUG logging, the body is usually logged and thus read. To deal with this, Camel has a streamCaching option that can cache the stream, enabling you to read it multiple times. from("jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething"); From Camel 1.5 onwards, the stream caching is default enabled, so it is not necessary to set the streamCaching() option. In Camel 2.0 we store big input streams (by default, over 64K) in a temp file using CachedOutputStream. When you close the input stream, the temp file will be deleted. Creating a JBI Service Unit If you have some Camel routes that you want to deploy inside JBI as a Service Unit, you can use the JBI Service Unit Archetype to create a new Maven project for the Service Unit. If you have an existing Maven project that you need to convert into a JBI Service Unit, you may want to consult ServiceMix Maven JBI Plugins for further help. The key steps are as follows: Create a Spring XML file at src/main/resources/camel-context.xml to bootstrap your routes inside the JBI Service Unit. Change the POM file's packaging to jbi-service-unit. Your pom.xml should look something like this to enable the jbi-service-unit packaging: project xmlns="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" modelVersion4.0.0/modelVersion groupIdmyGroupId/groupId artifactIdmyArtifactId/artifactId packagingjbi-service-unit/packaging
[CONF] Apache Camel SERVLET
SERVLET Page edited by Claus Ibsen Servlet Component Available as of Camel 2.0 The servlet: component provides HTTP based endpoints for consuming HTTP requests that arrive at a HTTP endpoint and this endpoint is bound to a published Servlet. Maven users will need to add the following dependency to their pom.xml for this component: dependency groupIdorg.apache.camel/groupId artifactIdcamel-servlet/artifactId versionx.x.x/version \!-\- use the same version as your Camel core version \-- /dependency URI format servlet://relative_path[?options] You can append query options to the URI in the following format, ?option=valueoption=value... Options Name Default Value Description httpBindingRef null Reference to an org.apache.camel.component.http.HttpBinding in the Registry. A HttpBinding implementation can be used to customize how to write a response. matchOnUriPrefix false Whether or not the CamelServlet should try to find a target consumer by matching the URI prefix, if no exact match is found. servletName null Specifies the servlet name that the servlet endpoint will bind to. If there is no servlet name specified, the servlet endpoint will be bind to first published Servlet Message Headers Camel will apply the same Message Headers as the HTTP component. Camel will also populate all request.parameter and request.headers. For example, if a client request has the URL, http://myserver/myserver?orderid=123, the exchange will contain a header named orderid with the value 123. Usage You can only consume from endpoints generated by the Servlet component. Therefore, it should only be used as input into your camel routes. To issue HTTP requests against other HTTP endpoints, use the HTTP Component Sample In this sample, we define a route that exposes a HTTP service at http://localhost:8080/camel/services/hello. First, you need to publish the CamelHttpTransportServlet through the normal Web Container, or OSGi Service. Use the Web.xml file to publish the CamelHttpTransportServlet as follows: web-app servlet servlet-nameCamelServlet/servlet-name display-nameCamel Http Transport Servlet/display-name servlet-class org.apache.camel.component.servlet.CamelHttpTransportServlet /servlet-class /servlet servlet-mapping servlet-nameCamelServlet/servlet-name url-pattern/services/*/url-pattern /servlet-mapping /web-app Use an Activator to publish the CamelHttpTransportServlet on the OSGi platform import java.util.Dictionary; import java.util.Hashtable; import javax.servlet.Servlet; import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.http.HttpContext; import org.osgi.service.http.HttpService; public final class ServletActivator implements BundleActivator { /** * HttpService reference. */ private ServiceReference httpServiceRef; /** * Called when the OSGi framework starts our bundle */ @SuppressWarnings("unchecked") public void start(BundleContext bc) throws Exception { httpServiceRef = bc.getServiceReference(HttpService.class.getName()); if (httpServiceRef != null) { final HttpService httpService = (HttpService)bc.getService(httpServiceRef); if (httpService != null) { // create a default context to share between registrations final HttpContext httpContext = httpService.createDefaultHttpContext(); // register the hello world servlet final Dictionary initParams = new Hashtable(); initParams.put("matchOnUriPrefix", "false"); initParams.put("servlet-name", "camelServlet"); httpService.registerServlet("/camel/services", // alias (Servlet)new CamelHttpTransportServlet(), // register servlet initParams, // init params httpContext // http context ); } } } /** * Called when the OSGi framework stops our bundle */ public void stop(BundleContext bc) throws Exception { if (httpServiceRef != null) { bc.ungetService(httpServiceRef); httpServiceRef = null; } } } Then you can define your route as follows: from("servlet:///hello?matchOnUriPrefix=true").process(new Processor() { public void process(Exchange exchange) throws Exception { String contentType = exchange.getIn().getHeader(Exchange.CONTENT_TYPE, String.class); String path = exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class); assertEquals("Get a wrong content type", CONTENT_TYPE, contentType); String charsetEncoding =
[CONF] Apache Camel SERVLET
SERVLET Page moved by Claus Ibsen From: Apache Camel Component List To: Apache Camel Components Children moved Change Notification Preferences View Online | Add Comment
[CONF] Apache Camel Cometd
Cometd Page moved by Claus Ibsen From: Apache Camel Component List To: Apache Camel Components Children moved Change Notification Preferences View Online | Add Comment
[CONF] Apache Camel CXFRS
CXFRS Page moved by Claus Ibsen From: Apache Camel Component List To: Apache Camel Components Children moved Change Notification Preferences View Online | Add Comment
[CONF] Apache Camel CXFRS
CXFRS Page edited by Claus Ibsen CXFRS Component The cxfrs: component provides integration with Apache CXF for connecting to JAX-RS services hosted in CXF. Maven users will need to add the following dependency to their pom.xml for this component: dependency groupIdorg.apache.camel/groupId artifactIdcamel-cxf/artifactId versionx.x.x/version !-- use the same version as your Camel core version -- /dependency URI format cxfrs://address?options Where address represents the CXF endpoint's address cxfrs:bean:rsEndpoint Where rsEndpoint represents the spring bean's name which presents the CXFRS client or server For either style above, you can append options to the URI as follows: cxf:bean:cxfEndpoint?ResourceClass=org.apache.camel.rs.Example Options Name Description Example Required? default value ResourcesClass The resource classes which you want to export as REST service resourcesClass=org.apache.camel.rs.Example1,org.apache.camel.rs.Exchange2 No None HttpClientAPI new to Camel 2.1 If it is true, the CxfRsProducer will use the HttpClientAPI to invoke the service If it is false, the CxfRsProducer will use the ProxyClientAPI to invoke the service httpClientAPI=true No true You can also configure the CXF REST endpoint through the spring configuration. Since there are lots of difference between the CXF REST client and CXF REST Server, we provides different configuration for them. Please check out the schema file and CXF REST user guide for more information. How to configure the REST endpoint in Camel ? In camel-cxf schema file, there are two elements for the REST endpoint definition. cxf:rsServer for REST consumer, cxf:rsClient for REST producer. You can find an camel REST service route configuration example here. beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd " !-- Defined the real JAXRS back end service -- jaxrs:server id="restService" address="http://localhost:9002" staticSubresourceResolution="true" jaxrs:serviceBeans ref bean="customerService"/ /jaxrs:serviceBeans /jaxrs:server bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.JSONProvider"/ bean id="customerService" class="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService" / !-- Defined the server endpoint to create the cxf-rs consumer -- cxf:rsServer id="rsServer" address="http://localhost:9000" serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService" / !-- Defined the client endpoint to create the cxf-rs consumer -- cxf:rsClient id="rsClient" address="http://localhost:9002" serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"/ !-- The camel route context -- camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" route from uri="cxfrs://bean://rsServer"/ !-- We can remove this configure as the CXFRS producer is using the HttpAPI by default -- setHeader headerName="CamelCxfRsUsingHttpAPI" constantTrue/constant /setHeader to uri="cxfrs://bean://rsClient"/ /route /camelContext /beans How to consumer the REST request in Camel ? CXF JAXRS front end implements the JAXRS(JSR311) API, so we can export the resources classes as a REST service. And we leverage the CXF Invoker API to turn a REST request into a normal Java object method invocation. Unlike the camel-restlet, you don't need to specify the URI template within your restlet endpoint, CXF take care of the REST request URI to resource class method mapping according to the JSR311 specification. All you need to do in Camel is delegate this method request to a right processor or endpoint. Here is an example protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() { errorHandler(new NoErrorHandlerBuilder()); from(CXF_RS_ENDPOINT_URI).process(new Processor() { public void process(Exchange exchange) throws Exception { Message inMessage = exchange.getIn(); // Get the operation name from in message String operationName = inMessage.getHeader(CxfConstants.OPERATION_NAME,
[CONF] Apache Camel Camel 2.1.0 Release
Camel 2.1.0 Release Page edited by Claus Ibsen Camel 2.1.0 release (Work in Progress) New and Noteworthy Welcome to the 2.1.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) Pluggable API for Management allowing 3rd party to manage Camel. Use org.apache.camel.spi.ManagementStrategy to plugin 3rd party adapter Fine grained events notifications is now being emitted using org.apache.camel.spi.EventNotifier Events being fired can be created using a pluggable factory using org.apache.camel.spi.EventFactory Camel now supports using multiple org.apache.camel.spi.LifecycleStrategy strategies, that also allows 3rd party to more easily integrate into Camel. Overhaul of default JMX management in Camel to be much improved with more attributes, mbeans, operations, statistics, and route timing working as well. And yes you can now start/stop routes and individual consumers and producers And some special processors such as Delayer and Throttler can be managed to change their delay/throttle values You can dynamic manage tracing even for already running applications Error handling in Camel is now also manageable so you for example can change the redelivery policies. JMS consumers being restarted will pickup any configuration changes on JMS endpoints such as changing concurrentConsumers. And yes its fully managed using JMX. Number of inflight exchanges per consumer, route and totally per camel context. And much more... Improved IRC, XMPP, MINA, CXF and Freemarker components with much thanks to the Camel community Added classLoader set and get method in the CamelContext to make Camel work better in the Container. Introduced camel-spring-osgi bundle which is merged from camel-spring and camel-osgi bundle to avoid the issue of installing upper bundles in a wrong order. Now Camel Karaf features are validated with the Karaf plugin. camel-cxf beans component supports JAXWS beans. camel-cxf MTOM attachment supports in Payload mode. Fixed the Null message will cause camel converter stop working issue. camel-cxf endpoint no longer requires the "serviceClass" option or Service Endpoint Interface (SEI) in Payload mode. It means only WSDL is needed but the intended port and service name in the WSDL must be provided for the camel-cxf endpoint. Velocity component supports to take the Velocity configuration by using propertiesFile option. Splitter and Multicast EIP patterns now support the option stopOnException to stop continue processing at first exception occurred. See their documentation for more details. Error handlers is restricted to be configured on camel context and/or routes only. Camel is now more robust and fault tolerant when shutting down. Fixed a race condition when shutting down Camel with JMS consumers that under some circumstances caused it to appear to hang Added pluggable org.apache.camel.spi.InflightRepository with a basic implementation that can help with graceful shutdown as you can now see how many exchanges are currently in progress. JmsEndpoint is now singleton Individual routes can be pre configured to not auto startup when Camel starts: autoStartup=false in XML DSL and noAutoStartup() in Java DSL. Camel is more robust on startup as route inputs are deferred to be started at the very end, ensuring all routes services have been pre started and thus ready when consumers is started. Improved unit test coverage, now having more than 4200 unit tests in total. Fixed ConsumerTemplate not working when it was dependency injected with @EndpointInjected in a Bean. Using IBM special JMS headers now work when sending messages to IBM WebSphere MQ. IBM special headers uses this prefix: JMS_IBM. In fact it works with any JMS_vendor_ header. The ordering of which routes should be started can now be configured by the startupOrder attribute which defines a number. Lowest number is started first. And autoStartup is also supported on CamelContext itself where it replaces the shouldStartContext option, which have been removed. Camel now checks on startup if multiple routes uses the same endpoint as inputs, if so it fails to start. This prevents starting Camel if you have routes with e.g. copy/paste typos. Only JMS and MINA support multiple routes to consume from same endpoint. The MultipeConsumersSupport interface can be optionally implemented by the endpoint to control this behavior. The File component handles renaming and deleting files on Windows better as Windows could block files. Also Antivirus software could causes files to be blocked. Fixed issues using tempPrefix option with the File in case of clashes with existing files. The same goes for the localWorkDirectory option on the FTP component which could have a similar issue. Optimized XPath to allow thread safe concurrency which greatly reduces contention. Camel works better with Google App
[CONF] Apache Camel Tracer
Tracer Page edited by Claus Ibsen Tracer Interceptor Camel supports a tracer interceptor that is used for logging the route executions at INFO level. The Tracer is an InterceptStrategy which can be applied to a DefaultCamelContext or SpringCamelContext to ensure that there is a TracerInterceptor created for every node in the DSL. You can enable or disable the Tracer's logging dynamically, by calling the tracer's setEnabled method. The org.apache.camel.processor.interceptor.TraceFormatter has been rename to org.apache.camel.processor.interceptor.DefaultTraceFormatter in Camel 2.0. Users of Camel 1.x should use TraceFormatter whereas 2.x users should use DefaultTraceFormatter. Options Trace has been improved in Camel 1.5 to be more configurable with these options: Option Default Description formatter Sets the Trace Formatter to use. Will default use org.apache.camel.processor.interceptor.DefaultTraceFormatter. enabled true Flag to enable or disable this tracer logLevel INFO The logging level to use: FATAL, ERROR, WARN, INFO, DEBUG, TRACE logName The log name to use. Will default use org.apache.camel.processor.interceptor.TraceInterceptor. traceFilter null An exchange Predicate to filter the tracing. traceInterceptors false Flag to enable or disable tracing of interceptors traceExceptions true Flag to enable or disable tracing of thrown exception during processing of the exchange logStackTrace false Camel 2.0: When tracing exception you can control whether the stack trace should be logged also. If not then only the exception class and message is logged. destinationUri null Camel 2.0: Optional destination uri to route TraceEventExchange containing TraceEventMessage with details about the trace. Can be used for custom processing to store traces in database using JPA. Formatting The tracer formats the execution of exchanges to log lines. They are logged at INFO level in the log category: org.apache.camel.processor.interceptor.TraceInterceptor. The tracer uses by default TraceFormatter to format the log line. TraceFormatter has the following options: Option Default Description breadCrumbLength 0 Camel 1.5.1: Fixed length of the bread crumb. 0 = no fixed length. Setting a value to e.g. 80 allows the tracer logs to be aligned for easier reading. nodeLength 0 Camel 1.5.1: Fixed length of the node. 0 = no fixed length. Setting a value to e.g. 40 allows the tracer logs to be aligned for easier reading. showBreadCrumb true Outputs the unique unit of work for the exchange. To be used for correlation so you can identify the same exchange. showNode true In Camel 1.x its the destination node. In Camel 2.0 its both the previous and destination node, so you can see from - to. showExchangeId false To output the unique exchange id. Currently the breadcrumb is sufficient. showShortExchangeId false Camel 1.5.1: To output the unique exchange id in short form, without the hostname. showProperties true Output the exchange properties showHeaders true Output the in message headers showBodyType true Output the in body Java type showBody true Output the in body showOutHeaders false Camel 2.0: Output the out (if any) message headers showOutBodyType false Camel 2.0: Output the out (if any) body Java type showOutBody false Camel 2.0: Output the out (if any) body showExchangePattern true Camel 1.5: Output the exchange pattern showException true Camel 1.5: Output the exception if the exchange has failed showRouteId true Camel 2.1: Output the route id maxChars Camel 2.0: Is used to limit the number of chars logged per line. Example: ID-claus-acer/4412-1222625653890/2-0 - to(mock:a), Pattern:InOnly , Headers:{to=James} , BodyType:String , Body:Hello London ID-claus-acer/3690-1214458315718/2-0 is the breadcrumb with the unique correlation id. node3 is the id of the node in the route path. Is always shown. To[mock:a] is the destination node. InOnly is the exchange pattern. Is always shown. Then the rest is properties, headers and the body. Showing from and to In Camel 2.0 the trace log will output both the from and to so you can see where the Exchange came from, such as: direct:start -- process(MyProcessor) process(MyProcessor) -- to(mock:a) to(mock:a) -- to(mock:b) Enabling To enable tracer from the main run java org.apache.camel.spring.Main -t or java org.apache.camel.spring.Main -trace and the tracer will be active. Enabling from Java DSL The tracer can be enabled by adding it to the interceptor chain to the camel context. This is demonstrated in the unit test below. Notice: We could have changed the properties on the Tracer object before adding it, if we e.g. don't like the default settings. public void
svn commit: r884845 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/management/mbean/ main/java/org/apache/camel/model/ main/java/org/apache/camel/processor/interceptor/ test/java/org/apa
Author: davsclaus Date: Fri Nov 27 12:05:44 2009 New Revision: 884845 URL: http://svn.apache.org/viewvc?rev=884845view=rev Log: CAMEL-2233: Tracer now show route id by default. Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceFormatter.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedTracerOptionsTest.java camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceInterceptorTest.java camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/DefaultTraceFormatterTest.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java?rev=884845r1=884844r2=884845view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java Fri Nov 27 12:05:44 2009 @@ -331,6 +331,22 @@ tracer.getDefaultTraceFormatter().setShowException(showException); } +@ManagedAttribute(description = Formatter show route id) +public boolean getFormatterShowRouteId() { +if (tracer.getDefaultTraceFormatter() == null) { +return false; +} +return tracer.getDefaultTraceFormatter().isShowRouteId(); +} + +@ManagedAttribute(description = Formatter show route id) +public void setFormatterShowRouteId(boolean showRouteId) { +if (tracer.getDefaultTraceFormatter() == null) { +return; +} +tracer.getDefaultTraceFormatter().setShowRouteId(showRouteId); +} + @ManagedAttribute(description = Formatter breadcrumb length) public int getFormatterBreadCrumbLength() { if (tracer.getDefaultTraceFormatter() == null) { @@ -394,5 +410,5 @@ } tracer.getDefaultTraceFormatter().setMaxChars(maxChars); } - + } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=884845r1=884844r2=884845view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Fri Nov 27 12:05:44 2009 @@ -722,14 +722,12 @@ @SuppressWarnings(unchecked) public Type routeId(String id) { ProcessorDefinition def = this; -// drill to the top -while (def.getParent() != null) { -def = def.getParent(); -} -if (def instanceof RouteDefinition) { -RouteDefinition route = (RouteDefinition) def; + +RouteDefinition route = ProcessorDefinitionHelper.getRoute(def); +if (route != null) { route.setId(id); } + return (Type) this; } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java?rev=884845r1=884844r2=884845view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java Fri Nov 27 12:05:44 2009 @@ -81,6 +81,32 @@ return node.getParent().getOutputs().get(0).equals(node); } +/** + * Gets the route definition the given node belongs to. + * + * @param node the node + * @return the route, or ttnull/tt if not possible to find + */ +public static RouteDefinition getRoute(ProcessorDefinition? node) { +if (node == null) { +return null; +} + +ProcessorDefinition def = node; +// drill to the top +while (def != null def.getParent() != null) { +def = def.getParent(); +} + +if (def instanceof RouteDefinition) { +return (RouteDefinition) def; +} else { +// not found +return null; +} + +} +
[CONF] Apache Camel Camel 2.1.0 Release
Camel 2.1.0 Release Page edited by Claus Ibsen Camel 2.1.0 release (Work in Progress) New and Noteworthy Welcome to the 2.1.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) Pluggable API for Management allowing 3rd party to manage Camel. Use org.apache.camel.spi.ManagementStrategy to plugin 3rd party adapter Fine grained events notifications is now being emitted using org.apache.camel.spi.EventNotifier Events being fired can be created using a pluggable factory using org.apache.camel.spi.EventFactory Camel now supports using multiple org.apache.camel.spi.LifecycleStrategy strategies, that also allows 3rd party to more easily integrate into Camel. Overhaul of default JMX management in Camel to be much improved with more attributes, mbeans, operations, statistics, and route timing working as well. And yes you can now start/stop routes and individual consumers and producers And some special processors such as Delayer and Throttler can be managed to change their delay/throttle values You can dynamic manage tracing even for already running applications Error handling in Camel is now also manageable so you for example can change the redelivery policies. JMS consumers being restarted will pickup any configuration changes on JMS endpoints such as changing concurrentConsumers. And yes its fully managed using JMX. Number of inflight exchanges per consumer, route and totally per camel context. And much more... Improved IRC, XMPP, MINA, CXF and Freemarker components with much thanks to the Camel community Added classLoader set and get method in the CamelContext to make Camel work better in the Container. Introduced camel-spring-osgi bundle which is merged from camel-spring and camel-osgi bundle to avoid the issue of installing upper bundles in a wrong order. Now Camel Karaf features are validated with the Karaf plugin. camel-cxf beans component supports JAXWS beans. camel-cxf MTOM attachment supports in Payload mode. Fixed the Null message will cause camel converter stop working issue. camel-cxf endpoint no longer requires the "serviceClass" option or Service Endpoint Interface (SEI) in Payload mode. It means only WSDL is needed but the intended port and service name in the WSDL must be provided for the camel-cxf endpoint. Velocity component supports to take the Velocity configuration by using propertiesFile option. Splitter and Multicast EIP patterns now support the option stopOnException to stop continue processing at first exception occurred. See their documentation for more details. Error handlers is restricted to be configured on camel context and/or routes only. Camel is now more robust and fault tolerant when shutting down. Fixed a race condition when shutting down Camel with JMS consumers that under some circumstances caused it to appear to hang Added pluggable org.apache.camel.spi.InflightRepository with a basic implementation that can help with graceful shutdown as you can now see how many exchanges are currently in progress. JmsEndpoint is now singleton Individual routes can be pre configured to not auto startup when Camel starts: autoStartup=false in XML DSL and noAutoStartup() in Java DSL. Camel is more robust on startup as route inputs are deferred to be started at the very end, ensuring all routes services have been pre started and thus ready when consumers is started. Improved unit test coverage, now having more than 4200 unit tests in total. Fixed ConsumerTemplate not working when it was dependency injected with @EndpointInjected in a Bean. Using IBM special JMS headers now work when sending messages to IBM WebSphere MQ. IBM special headers uses this prefix: JMS_IBM. In fact it works with any JMS_vendor_ header. The ordering of which routes should be started can now be configured by the startupOrder attribute which defines a number. Lowest number is started first. And autoStartup is also supported on CamelContext itself where it replaces the shouldStartContext option, which have been removed. Camel now checks on startup if multiple routes uses the same endpoint as inputs, if so it fails to start. This prevents starting Camel if you have routes with e.g. copy/paste typos. Only JMS and MINA support multiple routes to consume from same endpoint. The MultipeConsumersSupport interface can be optionally implemented by the endpoint to control this behavior. The File component handles renaming and deleting files on Windows better as Windows could block files. Also Antivirus software could causes files to be blocked. Fixed issues using tempPrefix option with the File in case of clashes with existing files. The same goes for the localWorkDirectory option on the FTP component which could have a similar issue. Optimized XPath to allow thread safe concurrency which greatly reduces contention. Camel works better with Google App
svn commit: r884876 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/component/file/ test/java/org/apache/camel/component/file/
Author: davsclaus Date: Fri Nov 27 13:46:03 2009 New Revision: 884876 URL: http://svn.apache.org/viewvc?rev=884876view=rev Log: CAMEL-2234: Fixed potential issue with copying large files using NIO hitting a 2gb limit. Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileToFileNioLowBufferTest.java (with props) Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java?rev=884876r1=884875r2=884876view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java Fri Nov 27 13:46:03 2009 @@ -222,7 +222,12 @@ if (LOG.isTraceEnabled()) { LOG.trace(Using FileChannel to transfer from: + in + to: + out); } -in.transferTo(0, in.size(), out); + +long size = in.size(); +long position = 0; +while (position size) { +position += in.transferTo(position, endpoint.getBufferSize(), out); +} } finally { ObjectHelper.close(in, source.getName(), LOG); ObjectHelper.close(out, source.getName(), LOG); Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java?rev=884876r1=884875r2=884876view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java Fri Nov 27 13:46:03 2009 @@ -385,6 +385,9 @@ } public void setBufferSize(int bufferSize) { +if (bufferSize = 0) { +throw new IllegalArgumentException(BufferSize must be a positive value, was + bufferSize); +} this.bufferSize = bufferSize; } Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileToFileNioLowBufferTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileToFileNioLowBufferTest.java?rev=884876view=auto == --- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileToFileNioLowBufferTest.java (added) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileToFileNioLowBufferTest.java Fri Nov 27 13:46:03 2009 @@ -0,0 +1,51 @@ +/** + * 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.file; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; + +/** + * @version $Revision$ + */ +public class FileToFileNioLowBufferTest extends ContextTestSupport { + +public void testFileToFileNioLowBuffer() throws Exception { +deleteDirectory(target/nio); + +String body = 1234567890123456789012345678901234567890; +MockEndpoint mock = getMockEndpoint(mock:result); +mock.expectedMessageCount(1); +mock.expectedFileExists(target/nio/out/hello.txt, body); + +template.sendBodyAndHeader(file://target/nio/in, body, Exchange.FILE_NAME, hello.txt); + +assertMockEndpointsSatisfied(); +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +@Override +public void configure() throws Exception { +
[CONF] Apache Camel Camel 2.1.0 Release
Camel 2.1.0 Release Page edited by Claus Ibsen Camel 2.1.0 release (Work in Progress) New and Noteworthy Welcome to the 2.1.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) Pluggable API for Management allowing 3rd party to manage Camel. Use org.apache.camel.spi.ManagementStrategy to plugin 3rd party adapter Fine grained events notifications is now being emitted using org.apache.camel.spi.EventNotifier Events being fired can be created using a pluggable factory using org.apache.camel.spi.EventFactory Camel now supports using multiple org.apache.camel.spi.LifecycleStrategy strategies, that also allows 3rd party to more easily integrate into Camel. Overhaul of default JMX management in Camel to be much improved with more attributes, mbeans, operations, statistics, and route timing working as well. And yes you can now start/stop routes and individual consumers and producers And some special processors such as Delayer and Throttler can be managed to change their delay/throttle values You can dynamic manage tracing even for already running applications Error handling in Camel is now also manageable so you for example can change the redelivery policies. JMS consumers being restarted will pickup any configuration changes on JMS endpoints such as changing concurrentConsumers. And yes its fully managed using JMX. Number of inflight exchanges per consumer, route and totally per camel context. And much more... Improved IRC, XMPP, MINA, CXF and Freemarker components with much thanks to the Camel community Added classLoader set and get method in the CamelContext to make Camel work better in the Container. Introduced camel-spring-osgi bundle which is merged from camel-spring and camel-osgi bundle to avoid the issue of installing upper bundles in a wrong order. Now Camel Karaf features are validated with the Karaf plugin. camel-cxf beans component supports JAXWS beans. camel-cxf MTOM attachment supports in Payload mode. Fixed the Null message will cause camel converter stop working issue. camel-cxf endpoint no longer requires the "serviceClass" option or Service Endpoint Interface (SEI) in Payload mode. It means only WSDL is needed but the intended port and service name in the WSDL must be provided for the camel-cxf endpoint. Velocity component supports to take the Velocity configuration by using propertiesFile option. Splitter and Multicast EIP patterns now support the option stopOnException to stop continue processing at first exception occurred. See their documentation for more details. Error handlers is restricted to be configured on camel context and/or routes only. Camel is now more robust and fault tolerant when shutting down. Fixed a race condition when shutting down Camel with JMS consumers that under some circumstances caused it to appear to hang Added pluggable org.apache.camel.spi.InflightRepository with a basic implementation that can help with graceful shutdown as you can now see how many exchanges are currently in progress. JmsEndpoint is now singleton Individual routes can be pre configured to not auto startup when Camel starts: autoStartup=false in XML DSL and noAutoStartup() in Java DSL. Camel is more robust on startup as route inputs are deferred to be started at the very end, ensuring all routes services have been pre started and thus ready when consumers is started. Improved unit test coverage, now having more than 4200 unit tests in total. Fixed ConsumerTemplate not working when it was dependency injected with @EndpointInjected in a Bean. Using IBM special JMS headers now work when sending messages to IBM WebSphere MQ. IBM special headers uses this prefix: JMS_IBM. In fact it works with any JMS_vendor_ header. The ordering of which routes should be started can now be configured by the startupOrder attribute which defines a number. Lowest number is started first. And autoStartup is also supported on CamelContext itself where it replaces the shouldStartContext option, which have been removed. Camel now checks on startup if multiple routes uses the same endpoint as inputs, if so it fails to start. This prevents starting Camel if you have routes with e.g. copy/paste typos. Only JMS and MINA support multiple routes to consume from same endpoint. The MultipeConsumersSupport interface can be optionally implemented by the endpoint to control this behavior. The File component handles renaming and deleting files on Windows better as Windows could block files. Also Antivirus software could causes files to be blocked. Fixed issues using tempPrefix option with the File in case of clashes with existing files. The same goes for the localWorkDirectory option on the FTP component which could have a similar issue. Optimized XPath to allow thread safe concurrency which greatly reduces contention. Camel works better with Google App
svn commit: r884894 - in /camel/trunk/camel-core/src/main/java/org/apache/camel/impl: DoCatchRouteNode.java OnExceptionRouteNode.java
Author: davsclaus Date: Fri Nov 27 15:26:36 2009 New Revision: 884894 URL: http://svn.apache.org/viewvc?rev=884894view=rev Log: Fixed potential NPE in tracer Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java?rev=884894r1=884893r2=884894view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java Fri Nov 27 15:26:36 2009 @@ -38,7 +38,13 @@ } public String getLabel(Exchange exchange) { -return doCatch[ + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + ]; +if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) { +return doCatch[ + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + ]; +} else if (exchange.getException() != null) { +return doCatch[ + exchange.getException().getClass().getSimpleName() + ]; +} else { +return doCatch[]; +} } public boolean isAbstract() { Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java?rev=884894r1=884893r2=884894view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java Fri Nov 27 15:26:36 2009 @@ -38,7 +38,13 @@ } public String getLabel(Exchange exchange) { -return OnException[ + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + ]; +if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) { +return OnException[ + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + ]; +} else if (exchange.getException() != null) { +return OnException[ + exchange.getException().getClass().getSimpleName() + ]; +} else { +return OnException[]; +} } public boolean isAbstract() {
svn commit: r885062 - /camel/trunk/components/camel-bam/pom.xml
Author: hadrian Date: Sat Nov 28 04:52:50 2009 New Revision: 885062 URL: http://svn.apache.org/viewvc?rev=885062view=rev Log: Fix running tests failure in camel-bam Modified: camel/trunk/components/camel-bam/pom.xml Modified: camel/trunk/components/camel-bam/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bam/pom.xml?rev=885062r1=885061r2=885062view=diff == --- camel/trunk/components/camel-bam/pom.xml (original) +++ camel/trunk/components/camel-bam/pom.xml Sat Nov 28 04:52:50 2009 @@ -91,21 +91,9 @@ plugin artifactIdmaven-surefire-plugin/artifactId configuration - childDelegationfalse/childDelegation - useFiletrue/useFile - forkModepertest/forkMode - includes -include**/*Test.*/include - /includes - excludes -!-- TODO no idea yet why this seems to fail in a recursive build - - but works in a build of just the camel-bam module -- - -!--exclude**/MultipleActivitiesConcurrentlyTest.*/exclude-- - /excludes + forkModealways/forkMode /configuration /plugin - /plugins /build