Routing Camel messages to Artemis embedded in WildFly

This is the second tutorial about Camel 3. In the first one (Getting started with Camel 3) we have discussed how to set up a basic Camel 3 projects and run a simple demo with it. Now we will show how to use the messasing API to connect to a remote ArtemisMQ embedded in a … Read more

Getting started with Camel 3

Let’s have a look at what’s new in Camel 3 with an example project which shows how to run a Camel 3 standalone via the built-in Main class. This example also demonstrates how you can configure the Camel application via Camel built-in dependency-injection that supports binding via the @BindToRegistry and @PropertyInject annotations. Apache Camel 3 … Read more

Calling a JAX-WS Web service from Camel

In this tutorial we will demonstrate how to invoke from Camel a JAX-WS Web service running on WildFly, without writing a single line of code. First of all, here is the Web service implementation: import javax.jws.WebService; @WebService public class SimpleWebSevice implements Simple { @Override public String hello(String s) { System.out.println(“Called Web service with: “+s); return … Read more

Proxy Web Services request with Camel

In this tutorial we will show how to proxy a request to a legacy JAX-WS Web service using Camel. A common scenario is that you have some legacy code (say some Web services) which cannot be reused becuase the interfaces or some conventions (e.g. namespaces) have changed. Proxing request to legacy code can also be … Read more

Building a Camel route to remote ActiveMQ

In this tutorial we will demonstrate how to create a simple Camel route which sends messages (based on a timer) to an ActiveMQ server. So first of all, let’s start ActiveMQ and verify that it’s listening on the TCP port: For example on a Windows machine: C:\>netstat -an | find “61616” TCP LISTENING … Read more

Basic Camel Architecture tutorial

This tutorial provides an overview of Camel architecture components. The Camel architecture consists of: CamelContext: This represents an instance of the Camel runtime environment running in a JVM. it represents a single Camel routing rulebase and works in a similar way to the Spring ApplicationContext. End points: They represent a message producer or consumer used … Read more

Transforming CSV to Java Objects using Camel

This tutorial shows how to perform a simple transformation from CSV to Java objects with Camel using as destination a processor or a JMS Queue. First of all, we will define a class mapping our CSV file. package com.sample.model; import; import org.apache.camel.dataformat.bindy.annotation.CsvRecord; import org.apache.camel.dataformat.bindy.annotation.DataField; @CsvRecord(separator = “,”) public class User implements Serializable { @DataField(pos … Read more

Using the Timer Component with Camel

The Timer component is used to generate message exchanges when a timer fires. The Timer is a simple, non persistence timer using the JDK’s in built timer mechanism. package com.sample; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.spi.DataFormat; public class Timer { public static void main(String args[]) throws Exception { CamelContext … Read more

Using Camel JDBC Component

In this tutorial we will learn how to perform some basic JDBC operations using Camel JDBC Component. The JDBC component enables you to access databases through JDBC, where SQL queries (SELECT) and operations (INSERT, UPDATE, etc) are sent in the message body. This component uses the standard JDBC API. In the following example, we will … Read more

Using Camel Netty Components to manage socket routes

The netty component is a socket based Caamel communication component, which relies on the Netty project. Netty is a client server framework designed around Java NIO API which enables fast and simple development of network applications either servers or clients. The advantage of using Netty is that it greatly simplifies network programming by means of … Read more