Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Eclipse Kura component

This documentation page covers the integration options of Camel with the Eclipse Kura M2M gateway.

KuraRouter activator

The easiest way to deploy Apache Camel routes into the Kura is to create an OSGi bundle containing the class extending org.apache.camel.kura.KuraRouter class:

...

Kura router starts its own OSGi-aware CamelContext. It means that for every class extending KuraRouter, there will be a dedicated CamelContext instance. Ideally we recommend to deploy one KuraRouter per OSGi bundle.

Deploying KuraRouter

Bundle containing your Kura router class should import the following bundles in the OSGi manifest:

...

Code Block
xml
xml
install file:///home/user/.m2/repository/com/example/myrouter/1.0/myrouter-1.0.jar
start <your-bundle-id>

Auto-configured consumer and producer templates

Camel auto-configuration provides a pre-configured ConsumerTemplate and ProducerTemplate instances. You can simply inject them into your Spring-managed beans:

...

Code Block
xml
xml
camel.springboot.consumerTemplateCacheSize = 100
camel.springboot.producerTemplateCacheSize = 200

Auto-configured TypeConverter

Camel auto-configuration registers TypeConverter instance named typeConverter in the Spring context.

Code Block
languagejava
@Component
public class InvoiceProcessor {

  @Autowired
  private TypeConverter typeConverter;

  public long parseInvoiceValue(Invoice invoice) {
    String invoiceValue = invoice.grossValue();
    return typeConverter.convertTo(Long.class, invoiceValue);
  }

}

Spring type conversion API bridge

Spring comes with the powerful type conversion API. Spring API happens not to be much different from the Camel type converter API. As those APIs are so similar, Camel Spring Boot automatically registers bridge converter (SpringTypeConverter) that delegates to the Spring conversion API. It basically means that out-of-the-box Camel will threat Spring Converters as Camel ones. With this approach you can enjoy both Camel and Spring converters accessed via Camel TypeConverter API:

...

Under the hood Camel Spring Boot delegates conversion to the Spring's ConversionService instances available in the application context. If no ConversionService instance is available, Camel Spring Boot auto-configuration will create one for you.

Disabling type conversions features

If you don't want Camel Spring Boot to register type-conversions related features (like TypeConverter instance or Spring bridge) set the camel.springboot.typeConversion property to false.

Code Block
xml
xml
camel.springboot.typeConversion = false

Fat jars and fat wars

The easiest way to create Camel-aware Spring Boot fat jar/war is to extend the org.apache.camel.spring.boot.FatJarRouter class...

...