You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/03/27 15:13:19 UTC

[camel-karaf] 01/05: Added camel-eventadmin in camel-karaf

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-karaf.git

commit b84f44233577ea1436818b0a417007c242abab3d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Mar 27 15:56:13 2020 +0100

    Added camel-eventadmin in camel-karaf
---
 components/camel-eventadmin/pom.xml                |  69 +++++++++++++
 .../eventadmin/EventAdminComponentConfigurer.java  |  60 +++++++++++
 .../eventadmin/EventAdminEndpointConfigurer.java   |  71 +++++++++++++
 .../services/org/apache/camel/component.properties |   7 ++
 .../services/org/apache/camel/component/eventadmin |   2 +
 .../apache/camel/configurer/eventadmin-component   |   2 +
 .../apache/camel/configurer/eventadmin-endpoint    |   2 +
 .../camel/component/eventadmin/eventadmin.json     |  37 +++++++
 .../src/main/docs/eventadmin-component.adoc        | 109 +++++++++++++++++++
 .../component/eventadmin/EventAdminComponent.java  |  62 +++++++++++
 .../component/eventadmin/EventAdminConstants.java  |  32 ++++++
 .../component/eventadmin/EventAdminConsumer.java   |  77 ++++++++++++++
 .../component/eventadmin/EventAdminEndpoint.java   |  84 +++++++++++++++
 .../component/eventadmin/EventAdminProducer.java   | 115 +++++++++++++++++++++
 components/pom.xml                                 |   1 +
 15 files changed, 730 insertions(+)

diff --git a/components/camel-eventadmin/pom.xml b/components/camel-eventadmin/pom.xml
new file mode 100644
index 0000000..eb2abba
--- /dev/null
+++ b/components/camel-eventadmin/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<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">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel.karaf</groupId>
+        <artifactId>components</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-eventadmin</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel Karaf :: Event Admin</name>
+    <description>Camel Karaf OSGi Event Admin support</description>
+
+    <properties>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-support</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.cmpn</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/components/camel-eventadmin/src/generated/java/org/apache/camel/component/eventadmin/EventAdminComponentConfigurer.java b/components/camel-eventadmin/src/generated/java/org/apache/camel/component/eventadmin/EventAdminComponentConfigurer.java
new file mode 100644
index 0000000..71edfdc
--- /dev/null
+++ b/components/camel-eventadmin/src/generated/java/org/apache/camel/component/eventadmin/EventAdminComponentConfigurer.java
@@ -0,0 +1,60 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.eventadmin;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class EventAdminComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+    @Override
+    public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
+        EventAdminComponent target = (EventAdminComponent) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "basicpropertybinding":
+        case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true;
+        case "bridgeerrorhandler":
+        case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
+        case "bundlecontext":
+        case "bundleContext": target.setBundleContext(property(camelContext, org.osgi.framework.BundleContext.class, value)); return true;
+        case "lazystartproducer":
+        case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
+        default: return false;
+        }
+    }
+
+    @Override
+    public Map<String, Object> getAllOptions(Object target) {
+        Map<String, Object> answer = new CaseInsensitiveMap();
+        answer.put("basicPropertyBinding", boolean.class);
+        answer.put("bridgeErrorHandler", boolean.class);
+        answer.put("bundleContext", org.osgi.framework.BundleContext.class);
+        answer.put("lazyStartProducer", boolean.class);
+        return answer;
+    }
+
+    @Override
+    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+        EventAdminComponent target = (EventAdminComponent) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "basicpropertybinding":
+        case "basicPropertyBinding": return target.isBasicPropertyBinding();
+        case "bridgeerrorhandler":
+        case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+        case "bundlecontext":
+        case "bundleContext": return target.getBundleContext();
+        case "lazystartproducer":
+        case "lazyStartProducer": return target.isLazyStartProducer();
+        default: return null;
+        }
+    }
+}
+
diff --git a/components/camel-eventadmin/src/generated/java/org/apache/camel/component/eventadmin/EventAdminEndpointConfigurer.java b/components/camel-eventadmin/src/generated/java/org/apache/camel/component/eventadmin/EventAdminEndpointConfigurer.java
new file mode 100644
index 0000000..3a2e693
--- /dev/null
+++ b/components/camel-eventadmin/src/generated/java/org/apache/camel/component/eventadmin/EventAdminEndpointConfigurer.java
@@ -0,0 +1,71 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.eventadmin;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class EventAdminEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+    @Override
+    public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
+        EventAdminEndpoint target = (EventAdminEndpoint) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "basicpropertybinding":
+        case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true;
+        case "bridgeerrorhandler":
+        case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
+        case "exceptionhandler":
+        case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true;
+        case "exchangepattern":
+        case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true;
+        case "lazystartproducer":
+        case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
+        case "send": target.setSend(property(camelContext, boolean.class, value)); return true;
+        case "synchronous": target.setSynchronous(property(camelContext, boolean.class, value)); return true;
+        default: return false;
+        }
+    }
+
+    @Override
+    public Map<String, Object> getAllOptions(Object target) {
+        Map<String, Object> answer = new CaseInsensitiveMap();
+        answer.put("basicPropertyBinding", boolean.class);
+        answer.put("bridgeErrorHandler", boolean.class);
+        answer.put("exceptionHandler", org.apache.camel.spi.ExceptionHandler.class);
+        answer.put("exchangePattern", org.apache.camel.ExchangePattern.class);
+        answer.put("lazyStartProducer", boolean.class);
+        answer.put("send", boolean.class);
+        answer.put("synchronous", boolean.class);
+        return answer;
+    }
+
+    @Override
+    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+        EventAdminEndpoint target = (EventAdminEndpoint) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "basicpropertybinding":
+        case "basicPropertyBinding": return target.isBasicPropertyBinding();
+        case "bridgeerrorhandler":
+        case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+        case "exceptionhandler":
+        case "exceptionHandler": return target.getExceptionHandler();
+        case "exchangepattern":
+        case "exchangePattern": return target.getExchangePattern();
+        case "lazystartproducer":
+        case "lazyStartProducer": return target.isLazyStartProducer();
+        case "send": return target.isSend();
+        case "synchronous": return target.isSynchronous();
+        default: return null;
+        }
+    }
+}
+
diff --git a/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/component.properties b/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/component.properties
new file mode 100644
index 0000000..2abaee6
--- /dev/null
+++ b/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/component.properties
@@ -0,0 +1,7 @@
+# Generated by camel build tools - do NOT edit this file!
+components=eventadmin
+groupId=org.apache.camel
+artifactId=camel-eventadmin
+version=3.2.0-SNAPSHOT
+projectName=Camel :: Event Admin
+projectDescription=Camel OSGi Event Admin support
diff --git a/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/component/eventadmin b/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/component/eventadmin
new file mode 100644
index 0000000..674fb8b
--- /dev/null
+++ b/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/component/eventadmin
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.eventadmin.EventAdminComponent
diff --git a/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/configurer/eventadmin-component b/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/configurer/eventadmin-component
new file mode 100644
index 0000000..7d53a5f
--- /dev/null
+++ b/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/configurer/eventadmin-component
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.eventadmin.EventAdminComponentConfigurer
diff --git a/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/configurer/eventadmin-endpoint b/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/configurer/eventadmin-endpoint
new file mode 100644
index 0000000..aa53eb1
--- /dev/null
+++ b/components/camel-eventadmin/src/generated/resources/META-INF/services/org/apache/camel/configurer/eventadmin-endpoint
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.eventadmin.EventAdminEndpointConfigurer
diff --git a/components/camel-eventadmin/src/generated/resources/org/apache/camel/component/eventadmin/eventadmin.json b/components/camel-eventadmin/src/generated/resources/org/apache/camel/component/eventadmin/eventadmin.json
new file mode 100644
index 0000000..d151c5c
--- /dev/null
+++ b/components/camel-eventadmin/src/generated/resources/org/apache/camel/component/eventadmin/eventadmin.json
@@ -0,0 +1,37 @@
+{
+  "component": {
+    "kind": "component",
+    "scheme": "eventadmin",
+    "extendsScheme": "",
+    "syntax": "eventadmin:topic",
+    "title": "OSGi EventAdmin",
+    "description": "The eventadmin component can be used in an OSGi environment to receive OSGi EventAdmin events and process them.",
+    "label": "eventbus",
+    "deprecated": false,
+    "async": false,
+    "consumerOnly": false,
+    "producerOnly": false,
+    "lenientProperties": false,
+    "javaType": "org.apache.camel.component.eventadmin.EventAdminComponent",
+    "firstVersion": "2.6.0",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-eventadmin",
+    "version": "3.2.0-SNAPSHOT"
+  },
+  "componentProperties": {
+    "bundleContext": { "kind": "property", "displayName": "Bundle Context", "group": "common", "required": false, "type": "object", "javaType": "org.osgi.framework.BundleContext", "deprecated": false, "secret": false, "description": "The OSGi BundleContext is automatic injected by Camel" },
+    "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by [...]
+    "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the r [...]
+    "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" }
+  },
+  "properties": {
+    "topic": { "kind": "path", "displayName": "Topic", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Name of topic to listen or send to" },
+    "send": { "kind": "parameter", "displayName": "Send", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether to use 'send' or 'synchronous' deliver. Default false (async delivery)" },
+    "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled b [...]
+    "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with [...]
+    "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
+    "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the  [...]
+    "basicPropertyBinding": { "kind": "parameter", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" },
+    "synchronous": { "kind": "parameter", "displayName": "Synchronous", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "description": "Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported)." }
+  }
+}
diff --git a/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc b/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
new file mode 100644
index 0000000..ed5dc69
--- /dev/null
+++ b/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
@@ -0,0 +1,109 @@
+[[eventadmin-component]]
+= OSGi EventAdmin Component
+
+*Since Camel 2.6*
+
+// HEADER START
+*Both producer and consumer is supported*
+// HEADER END
+
+The Eventadmin component can be used in an OSGi environment to receive
+OSGi EventAdmin events and process them.
+
+== Dependencies
+
+Maven users need to add the following dependency to their `pom.xml`
+
+[source,xml]
+-------------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-eventadmin</artifactId>
+  <version>${camel-version}</version>
+</dependency>
+-------------------------------------------
+
+where `${camel-version`} must be replaced by the actual version of Camel.
+
+== URI format
+
+[source,xml]
+--------------------------
+eventadmin:topic[?options]
+--------------------------
+
+where `topic` is the name of the topic to listen too.
+
+== URI options
+
+// component options: START
+The OSGi EventAdmin component supports 4 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *bundleContext* (common) | The OSGi BundleContext is automatic injected by Camel |  | BundleContext
+| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
+| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...]
+| *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
+|===
+// component options: END
+
+// endpoint options: START
+The OSGi EventAdmin endpoint is configured using URI syntax:
+
+----
+eventadmin:topic
+----
+
+with the following path and query parameters:
+
+=== Path Parameters (1 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *topic* | Name of topic to listen or send to |  | String
+|===
+
+
+=== Query Parameters (7 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *send* (common) | Whether to use 'send' or 'synchronous' deliver. Default false (async delivery) | false | boolean
+| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
+| *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
+| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. The value can be one of: InOnly, InOut, InOptionalOut |  | ExchangePattern
+| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...]
+| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
+| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
+|===
+// endpoint options: END
+
+== Message headers
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Message |Description
+| | |
+|=======================================================================
+
+== Message body
+
+The `in` message body will be set to the received Event.
+
+== Example usage
+
+[source,xml]
+------------------------------
+<route>
+    <from uri="eventadmin:*"/>
+    <to uri="stream:out"/>
+</route>
+------------------------------
diff --git a/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponent.java b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponent.java
new file mode 100644
index 0000000..71cd004
--- /dev/null
+++ b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponent.java
@@ -0,0 +1,62 @@
+/*
+ * 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.eventadmin;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
+import org.osgi.framework.BundleContext;
+
+/**
+ * OSGi EventAdmin component.
+ */
+@Component("eventadmin")
+public class EventAdminComponent extends DefaultComponent {
+
+    private BundleContext bundleContext;
+
+    public EventAdminComponent() {
+    }
+
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    /**
+     * The OSGi BundleContext is automatic injected by Camel
+     */
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        EventAdminEndpoint endpoint = new EventAdminEndpoint(uri, this, remaining);
+        setProperties(endpoint, parameters);
+        return endpoint;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        ObjectHelper.notNull(bundleContext, "BundleContext", this);
+    }
+
+}
diff --git a/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConstants.java b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConstants.java
new file mode 100644
index 0000000..f07a5a6
--- /dev/null
+++ b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConstants.java
@@ -0,0 +1,32 @@
+/*
+ * 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.eventadmin;
+
+/**
+ * EventAdmin constants
+ */
+public final class EventAdminConstants {
+   
+    /**
+     * A header used to explicitely specify the target topic for the Exchange
+     */
+    public static final String EVENTADMIN_TOPIC = "CamelEventAdminTopic";
+
+    private EventAdminConstants() {
+        // constants class
+    }
+}
diff --git a/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConsumer.java b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConsumer.java
new file mode 100644
index 0000000..50c34fc
--- /dev/null
+++ b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConsumer.java
@@ -0,0 +1,77 @@
+/*
+ * 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.eventadmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.support.DefaultConsumer;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventConstants;
+import org.osgi.service.event.EventHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class EventAdminConsumer extends DefaultConsumer implements EventHandler {
+
+    private static final Logger LOG = LoggerFactory.getLogger(EventAdminConsumer.class);
+
+    private final EventAdminEndpoint endpoint;
+    private ServiceRegistration<?> registration;
+
+    public EventAdminConsumer(EventAdminEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    public void handleEvent(Event event) {
+        Exchange exchange = endpoint.createExchange();
+        // TODO: populate exchange headers
+        exchange.getIn().setBody(event);
+
+        LOG.trace("EventAdmin {} is firing", endpoint.getTopic());
+        try {
+            getProcessor().process(exchange);
+            // log exception if an exception occurred and was not handled
+            if (exchange.getException() != null) {
+                getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
+            }
+        } catch (Exception e) {
+            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
+        }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        Dictionary<String, String> props = new Hashtable<>();
+        props.put(EventConstants.EVENT_TOPIC, endpoint.getTopic());
+        registration = endpoint.getComponent().getBundleContext().registerService(EventHandler.class.getName(), this, props);
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        if (registration != null) {
+            registration.unregister();
+        }
+        super.doStop();
+    }
+}
diff --git a/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminEndpoint.java b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminEndpoint.java
new file mode 100644
index 0000000..e414656
--- /dev/null
+++ b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminEndpoint.java
@@ -0,0 +1,84 @@
+/*
+ * 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.eventadmin;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.MultipleConsumersSupport;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.DefaultEndpoint;
+
+/**
+ * The eventadmin component can be used in an OSGi environment to receive OSGi EventAdmin events and process them.
+ */
+@UriEndpoint(firstVersion = "2.6.0", scheme = "eventadmin", title = "OSGi EventAdmin", syntax = "eventadmin:topic", label = "eventbus")
+public class EventAdminEndpoint extends DefaultEndpoint implements MultipleConsumersSupport {
+
+    @UriPath
+    private final String topic;
+    @UriParam
+    private boolean send;
+
+    public EventAdminEndpoint(String uri, EventAdminComponent component, String topic) {
+        super(uri, component);
+        this.topic = topic;
+    }
+
+    /**
+     * Name of topic to listen or send to
+     */
+    public String getTopic() {
+        return topic;
+    }
+
+    public boolean isSend() {
+        return send;
+    }
+
+    /**
+     * Whether to use 'send' or 'synchronous' deliver.
+     * Default false (async delivery)
+     */
+    public void setSend(boolean send) {
+        this.send = send;
+    }
+
+    @Override
+    public EventAdminComponent getComponent() {
+        return (EventAdminComponent) super.getComponent();
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        return new EventAdminProducer(this);
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        EventAdminConsumer answer = new EventAdminConsumer(this, processor);
+        configureConsumer(answer);
+        return answer;
+    }
+
+    @Override
+    public boolean isMultipleConsumersSupported() {
+        return true;
+    }
+}
diff --git a/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java
new file mode 100644
index 0000000..f509964
--- /dev/null
+++ b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java
@@ -0,0 +1,115 @@
+/*
+ * 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.eventadmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.support.CamelContextHelper;
+import org.apache.camel.support.DefaultProducer;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * EventAdmin producer
+ */
+public class EventAdminProducer extends DefaultProducer {
+
+    private final EventAdminEndpoint endpoint;
+    private ServiceTracker<Object, Object> tracker;
+
+    public EventAdminProducer(EventAdminEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+        this.tracker = new ServiceTracker<>(endpoint.getComponent().getBundleContext(), EventAdmin.class.getName(), null);
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        this.tracker.open();
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        this.tracker.close();
+        super.doStop();
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        EventAdmin admin = (EventAdmin) this.tracker.getService();
+        if (admin != null) {
+            Event event = getEvent(exchange);
+            if (endpoint.isSend()) {
+                admin.sendEvent(event);
+            } else {
+                admin.postEvent(event);
+            }
+        } else {
+            throw new CamelExchangeException("EventAdmin service not present", exchange);
+        }
+    }
+
+    protected String getTopic(Exchange exchange) {
+        Message in = exchange.getIn();
+        String topic = in.getHeader(EventAdminConstants.EVENTADMIN_TOPIC, String.class);
+        if (topic != null) {
+            in.removeHeader(EventAdminConstants.EVENTADMIN_TOPIC);
+        }
+        if (topic == null) {
+            topic = endpoint.getTopic();
+        }
+        return topic;
+    }
+
+    protected Event getEvent(Exchange exchange) {
+        Message in = exchange.getIn();
+        CamelContext context = endpoint.getCamelContext();
+        Event event = context.getTypeConverter().convertTo(Event.class, exchange, in.getBody());
+        if (event == null) {
+            String topic = getTopic(exchange);
+            Dictionary<String, ?> props = getProperties(exchange);
+            event = new Event(topic, props);
+        }
+        return event;
+    }
+
+    protected Dictionary<String, ?> getProperties(Exchange exchange) {
+        Message in = exchange.getIn();
+        CamelContext context = endpoint.getCamelContext();
+        Map<?, ?> map = context.getTypeConverter().convertTo(Map.class, exchange, in.getBody());
+        Dictionary<String, Object> dict = new Hashtable<>();
+        for (Entry<?, ?> entry : map.entrySet()) {
+            String keyString = CamelContextHelper.convertTo(context, String.class, entry.getKey());
+            if (keyString != null) {
+                Object val = entry.getValue();
+                // TODO: convert to acceptable value
+                dict.put(keyString, val);
+            }
+        }
+        return dict;
+    }
+
+}
diff --git a/components/pom.xml b/components/pom.xml
index f0da259..747d03b 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -37,6 +37,7 @@
         <module>camel-test-blueprint</module>
         <module>camel-cxf-blueprint</module>
         <module>camel-cxf-transport-blueprint</module>
+        <module>camel-eventadmin</module>
         <module>camel-kura</module>
         <module>camel-osgi-activator</module>
         <module>camel-paxlogging</module>