Apache camel javadoc download




















For example when the route has completed 5 messages. You can build complex expressions to match your criteria when to be notified. Allows you to advice enhance an existing route using a RouteBuilder style. For example, you can send or send and skip message to a Mock endpoint for validating the message send by Camel is as expected. Framework for automated integration tests supporting a wide range of message protocols and data formats.

Edit this Page. Testing Testing is a crucial activity in any piece of software development or integration. Testing modules The following modules are supported:. Component Description camel-test JUnit 4 deprecated : Is a standalone Java library letting you easily create Camel test cases using a single Java class for all your configuration and routing without.

If you are using Camel Quarkus then you can find information in its documentation how to do testing with Quarkus and Camel. For more details on the different testing modules, then see their respective documentation from the links in the table above. Testing functionality Camel provides a set of features that are common to use when writing unit or integration tests with Camel.

Testing endpoints Camel provides a number of endpoints which can make testing easier. Name Description Mock For testing routes and mediation rules using mocks and allowing assertions to be added to an endpoint. A registry does not have to be public or globally accessible. For example, urn:employee might be meaningful only within a specific company. IRI is an acronym for internationalized resource identifier. Component is confusing terminology; EndpointFactory would have been more appropriate because a Component is a factory for creating Endpoint instances.

For example, if a Camel-based application uses several JMS queues then the application will create one instance of the JmsComponent class which implements the Component interface , and then the application invokes the createEndpoint operation on this JmsComponent object several times.

Each invocation of JmsComponent. Actually, application-level code does not invoke Component. Instead, application-level code normally invokes CamelContext. The parameter to getEndpoint is a URI.

The URI prefix that is, the part before : specifies the name of a component. Internally, the CamelContext object maintains a mapping from names of components to Component objects. For the URI given in the above example, the CamelContext object would probably map the pop3 prefix to an instance of the MailComponent class. The createEndpoint operation splits the URI into its component parts and uses these parts to create and configure an Endpoint object.

In the previous paragraph, I mentioned that a CamelContext object maintains a mapping from component names to Component objects. This raises the question of how this map is populated with named Component objects.

There are two ways of populating the map. The first way is for application-level code to invoke CamelContext. The example below shows a single MailComponent object being registered in the map under 3 different names. The second and preferred way to populate the map of named Component objects in the CamelContext object is to let the CamelContext object perform lazy initialization.

This approach relies on developers following a convention when they write a class that implements the Component interface. I illustrate the convention by an example. FooComponent and you want Camel to automatically recognize this by the name foo.

This is shown below:. If you want Camel to also recognize the class by the name bar then you write another properties file in the same directory called bar that has the same contents. Once you have written the properties file s , you create a JAR file that contains the com. As I said in Section "Endpoint" , Camel provides out-of-the-box support for numerous communication technologies.

The out-of-the-box support consists of classes that implement the Component interface plus properties files that enable a CamelContext object to populate its map of named Component objects.

Earlier in this section I gave the following example of calling CamelContext. I said that because the online Camel documentation and the Camel source code both claim the parameter is a URI. In reality, the parameter is restricted to being a URL. This is because when Camel extracts the component name from the parameter, it looks for the first ":", which is a simplistic algorithm. Now consider the following calls to getEndpoint :.

Camel identifies the components in the above example as pop3 , jms , urn and urn. It would be more useful if the latter components were identified as urn:foo and urn:bar or, alternatively, as foo and bar that is, by skipping over the urn: prefix.

The Message interface provides an abstraction for a single message, such as a request, reply or exception message. There are concrete classes that implement the Message interface for each Camel-supported communications technology. The public API of the Message interface provides get- and set-style methods to access the message id , body and individual header fields of a message. The Exchange interface provides an abstraction for an exchange of messages, that is, a request message and its corresponding reply or exception message.

In Camel terminology, the request, reply and exception messages are called in , out and fault messages. There are concrete classes that implement the Exchange interface for each Camel-supported communications technology. The public API of the Exchange interface is quite limited. This is intentional, and it is expected that each class that implements this interface will provide its own technology-specific operations. Application-level programmers rarely access the Exchange interface or classes that implement it directly.

However, many classes in Camel are generic types that are instantiated on a class that implements Exchange. Because of this, the Exchange interface appears a lot in the generic signatures of classes and methods. The Processor interface represents a class that processes a message.

The signature of this interface is shown below:. Notice that the parameter to the process method is an Exchange rather than a Message. This provides flexibility. Version Note Download Signature and checksum 2. Edit this Page Back to top.

Release notes Supports Java 11 Released in Nov Release notes Released in Jan Release notes Supports Java 8 and 11 Released in Sep Connectors download list.



0コメント

  • 1000 / 1000