You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/06/16 15:39:07 UTC
[06/13] camel git commit: CAMEL-10054: Create camel-atomix component
CAMEL-10054: Create camel-atomix component
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/14f88f2e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/14f88f2e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/14f88f2e
Branch: refs/heads/master
Commit: 14f88f2e6cc0733dc72ff35a05973787c8dfec44
Parents: 21b65d9
Author: lburgazzoli <lb...@gmail.com>
Authored: Thu Jun 1 19:27:31 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Fri Jun 16 17:37:54 2017 +0200
----------------------------------------------------------------------
components/camel-atomix/pom.xml | 9 +-
.../src/main/docs/atomix-client-component.adoc | 6 +
.../src/main/docs/atomix-cluster-component.adoc | 27 +++
.../src/main/docs/atomix-component.adoc | 6 -
.../component/atomix/AtomixConfiguration.java | 80 +++++++
.../atomix/client/AtomixClientComponent.java | 36 +++
.../client/AtomixClientConfiguration.java | 25 +++
.../atomix/cluster/AtomixClusterComponent.java | 36 +++
.../cluster/AtomixClusterConfiguration.java | 85 +++++++
.../component/atomix/ha/AtomixCluster.java | 51 +++--
.../atomix/ha/AtomixClusterFactory.java | 28 ---
.../atomix/ha/AtomixClusterService.java | 224 +++++++++++++++++++
.../component/atomix/ha/AtomixClusterView.java | 54 +++--
.../services/org/apache/camel/component/atomix | 18 --
.../org/apache/camel/component/atomix-client | 18 ++
.../org/apache/camel/component/atomix-cluster | 18 ++
.../atomix/ha/AtomixRoutePolicyMain.java | 144 +++++-------
.../camel-atomix-starter/pom.xml | 53 +++++
.../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++
.../src/main/resources/META-INF/NOTICE.txt | 11 +
.../src/main/resources/META-INF/spring.provides | 17 ++
.../spring-boot/components-starter/pom.xml | 1 +
22 files changed, 971 insertions(+), 179 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-atomix/pom.xml b/components/camel-atomix/pom.xml
index 3afb62e..ca4ad29 100644
--- a/components/camel-atomix/pom.xml
+++ b/components/camel-atomix/pom.xml
@@ -34,9 +34,14 @@
<description>Camel Atomix support</description>
<properties>
- <camel.osgi.export.pkg>org.apache.camel.component.atomix.*</camel.osgi.export.pkg>
+ <camel.osgi.export.pkg>
+ org.apache.camel.component.atomix.*,
+ org.apache.camel.component.atomix.client.*,
+ org.apache.camel.component.atomix.cluster.*
+ </camel.osgi.export.pkg>
<camel.osgi.export.service>
- org.apache.camel.spi.ComponentResolver;component=atomix
+ org.apache.camel.spi.ComponentResolver;component=atomix-client,
+ org.apache.camel.spi.ComponentResolver;component=atomix-cluster,
</camel.osgi.export.service>
</properties>
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/docs/atomix-client-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/docs/atomix-client-component.adoc b/components/camel-atomix/src/main/docs/atomix-client-component.adoc
new file mode 100644
index 0000000..20ece42
--- /dev/null
+++ b/components/camel-atomix/src/main/docs/atomix-client-component.adoc
@@ -0,0 +1,6 @@
+## Atomix Client Component
+
+*Available as of Camel version 2.20*
+
+The camel atomix component allows you to work with Atomix, a fault-tolerant distributed coordination framework.
+
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/docs/atomix-cluster-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/docs/atomix-cluster-component.adoc b/components/camel-atomix/src/main/docs/atomix-cluster-component.adoc
new file mode 100644
index 0000000..80f2f7e
--- /dev/null
+++ b/components/camel-atomix/src/main/docs/atomix-cluster-component.adoc
@@ -0,0 +1,27 @@
+## Atomix Cluster Component
+
+*Available as of Camel version 2.20*
+
+The camel atomix component allows you to work with Atomix, a fault-tolerant distributed coordination framework.
+
+
+mvn \
+ -Datomix.cluster="127.0.0.1:9001,127.0.0.1:9002,127.0.0.1:9003" \
+ -Dexec.mainClass=org.apache.camel.component.atomix.ha.AtomixRoutePolicyMain \
+ -Dexec.classpathScope=test \
+ test-compile \
+ exec:java
+
+mvn \
+ -Datomix.cluster="127.0.0.1:9002,127.0.0.1:9001,127.0.0.1:9003" \
+ -Dexec.mainClass=org.apache.camel.component.atomix.ha.AtomixRoutePolicyMain \
+ -Dexec.classpathScope=test \
+ test-compile \
+ exec:java
+
+mvn \
+ -Datomix.cluster="127.0.0.1:9003,127.0.0.1:9001,127.0.0.1:9002" \
+ -Dexec.mainClass=org.apache.camel.component.atomix.ha.AtomixRoutePolicyMain \
+ -Dexec.classpathScope=test \
+ test-compile \
+ exec:java
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/docs/atomix-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/docs/atomix-component.adoc b/components/camel-atomix/src/main/docs/atomix-component.adoc
deleted file mode 100644
index e499f1b..0000000
--- a/components/camel-atomix/src/main/docs/atomix-component.adoc
+++ /dev/null
@@ -1,6 +0,0 @@
-## Atomix Component
-
-*Available as of Camel version 2.20*
-
-The camel atomix component allows you to work with Atomix, a fault-tolerant distributed coordination framework.
-
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/AtomixConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/AtomixConfiguration.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/AtomixConfiguration.java
new file mode 100644
index 0000000..4504488
--- /dev/null
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/AtomixConfiguration.java
@@ -0,0 +1,80 @@
+/**
+ * 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
+ */
+package org.apache.camel.component.atomix;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import io.atomix.catalyst.transport.Address;
+import io.atomix.catalyst.transport.Transport;
+import io.atomix.catalyst.transport.netty.NettyTransport;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.util.ObjectHelper;
+
+public class AtomixConfiguration {
+ @UriParam(javaType = "java.lang.String")
+ private List<Address> nodes = Collections.emptyList();
+
+ @UriParam(defaultValue = "io.atomix.catalyst.transport.netty.NettyTransport")
+ private Class<? extends Transport> transport = NettyTransport.class;
+
+ @UriParam
+ private String configurationUri;
+
+ protected AtomixConfiguration() {
+ }
+
+ public List<Address> getNodes() {
+ return nodes;
+ }
+
+ /**
+ * The address of the nodes composing the cluster.
+ */
+ public void setNodes(List<Address> nodes) {
+ this.nodes = ObjectHelper.notNull(nodes, "Atomix Nodes");
+ }
+
+ public void setNodes(String nodes) {
+ if (ObjectHelper.isNotEmpty(nodes)) {
+ setNodes(Stream.of(nodes.split(",")).map(Address::new).collect(Collectors.toList()));
+ }
+ }
+
+ public Class<? extends Transport> getTransport() {
+ return transport;
+ }
+
+ /**
+ * Sets the Atomix transport.
+ */
+ public void setTransport(Class<? extends Transport> transport) {
+ this.transport = transport;
+ }
+
+ public String getConfigurationUri() {
+ return configurationUri;
+ }
+
+ /**
+ * The Atomix configuration uri.
+ */
+ public void setConfigurationUri(String configurationUri) {
+ this.configurationUri = configurationUri;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/client/AtomixClientComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/client/AtomixClientComponent.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/client/AtomixClientComponent.java
new file mode 100644
index 0000000..c4348c4
--- /dev/null
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/client/AtomixClientComponent.java
@@ -0,0 +1,36 @@
+/**
+ * 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
+ */
+package org.apache.camel.component.atomix.client;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+
+public class AtomixClientComponent extends DefaultComponent {
+ public AtomixClientComponent() {
+ }
+
+ public AtomixClientComponent(CamelContext camelContext) {
+ super(camelContext);
+ }
+
+ @Override
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/client/AtomixClientConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/client/AtomixClientConfiguration.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/client/AtomixClientConfiguration.java
new file mode 100644
index 0000000..628f88b
--- /dev/null
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/client/AtomixClientConfiguration.java
@@ -0,0 +1,25 @@
+/**
+ * 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
+ */
+package org.apache.camel.component.atomix.client;
+
+import org.apache.camel.component.atomix.AtomixConfiguration;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class AtomixClientConfiguration extends AtomixConfiguration {
+ public AtomixClientConfiguration() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/cluster/AtomixClusterComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/cluster/AtomixClusterComponent.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/cluster/AtomixClusterComponent.java
new file mode 100644
index 0000000..fa1cace
--- /dev/null
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/cluster/AtomixClusterComponent.java
@@ -0,0 +1,36 @@
+/**
+ * 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
+ */
+package org.apache.camel.component.atomix.cluster;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+
+public class AtomixClusterComponent extends DefaultComponent {
+ public AtomixClusterComponent() {
+ }
+
+ public AtomixClusterComponent(CamelContext camelContext) {
+ super(camelContext);
+ }
+
+ @Override
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/cluster/AtomixClusterConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/cluster/AtomixClusterConfiguration.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/cluster/AtomixClusterConfiguration.java
new file mode 100644
index 0000000..5d1cbb1
--- /dev/null
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/cluster/AtomixClusterConfiguration.java
@@ -0,0 +1,85 @@
+/**
+ * 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
+ */
+package org.apache.camel.component.atomix.cluster;
+
+import io.atomix.AtomixReplica;
+import io.atomix.copycat.server.storage.StorageLevel;
+import org.apache.camel.component.atomix.AtomixConfiguration;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class AtomixClusterConfiguration extends AtomixConfiguration {
+
+ @UriParam
+ private String storagePath;
+
+ @UriParam(defaultValue = "MEMORY")
+ private StorageLevel storageLevel = StorageLevel.MEMORY;
+
+ @UriParam
+ private String replicaRef;
+
+ @UriParam
+ private AtomixReplica replica;
+
+ public AtomixClusterConfiguration() {
+ }
+
+ public String getStoragePath() {
+ return storagePath;
+ }
+
+ /**
+ * Sets the log directory.
+ */
+ public void setStoragePath(String storagePath) {
+ this.storagePath = storagePath;
+ }
+
+ public StorageLevel getStorageLevel() {
+ return storageLevel;
+ }
+
+ /**
+ * Sets the log storage level.
+ */
+ public void setStorageLevel(StorageLevel storageLevel) {
+ this.storageLevel = storageLevel;
+ }
+
+ public String getReplicaRef() {
+ return replicaRef;
+ }
+
+ /**
+ * Set the reference of an instance of {@link AtomixReplica}.
+ */
+ public void setReplicaRef(String clusterref) {
+ this.replicaRef = clusterref;
+ }
+
+ public AtomixReplica getReplica() {
+ return replica;
+ }
+
+ /**
+ * Set an instance of {@link AtomixReplica}.
+ */
+ public void setReplica(AtomixReplica replica) {
+ this.replica = replica;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixCluster.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixCluster.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixCluster.java
index 56f9084..10d53bc 100644
--- a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixCluster.java
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixCluster.java
@@ -16,32 +16,53 @@
*/
package org.apache.camel.component.atomix.ha;
-import io.atomix.Atomix;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import io.atomix.AtomixReplica;
+import io.atomix.catalyst.transport.Address;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.ha.AbstractCamelCluster;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-/**
- * TODO: Dummy implementation for testing purpose
- */
-public class AtomixCluster extends AbstractCamelCluster<AtomixClusterView> {
- private final Atomix atomix;
+public final class AtomixCluster extends AbstractCamelCluster<AtomixClusterView> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AtomixCluster.class);
+
+ private final AtomixReplica atomix;
+ private final List<Address> addresses;
+
+ public AtomixCluster(AtomixReplica atomix) {
+ this(null, atomix, Collections.emptyList());
+ }
- public AtomixCluster(Atomix atomix) {
- this(null, atomix);
+ public AtomixCluster(AtomixReplica atomix, List<Address> addresses) {
+ this(null, atomix, addresses);
}
- public AtomixCluster(CamelContext camelContext, Atomix atomix) {
+ public AtomixCluster(CamelContext camelContext, AtomixReplica atomix, List<Address> addresses) {
super("camel-atomix", camelContext);
this.atomix = atomix;
+ this.addresses = new ArrayList<>(addresses);
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ // Assume that if addresses are provided the cluster needs be bootstrapped.
+ if (ObjectHelper.isNotEmpty(addresses)) {
+ LOGGER.debug("Bootstrap cluster for nodes: {}", addresses);
+ this.atomix.bootstrap(addresses).join();
+ LOGGER.debug("Bootstrap cluster done");
+ }
+
+ super.doStart();
}
@Override
- public AtomixClusterView doCreateView(String namespace) throws Exception {
- return new AtomixClusterView(
- this,
- namespace,
- atomix.getGroup(namespace).join()
- );
+ protected AtomixClusterView doCreateView(String namespace) throws Exception {
+ return new AtomixClusterView(this, namespace, atomix);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterFactory.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterFactory.java
deleted file mode 100644
index a0f6835..0000000
--- a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.atomix.ha;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.ha.CamelCluster;
-import org.apache.camel.ha.CamelClusterFactory;
-
-public class AtomixClusterFactory implements CamelClusterFactory {
- @Override
- public CamelCluster newInstance(CamelContext camelContext) throws Exception {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterService.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterService.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterService.java
new file mode 100644
index 0000000..61fc817
--- /dev/null
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterService.java
@@ -0,0 +1,224 @@
+/**
+ * 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.atomix.ha;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Properties;
+
+import io.atomix.Atomix;
+import io.atomix.AtomixReplica;
+import io.atomix.catalyst.transport.Address;
+import io.atomix.catalyst.transport.Transport;
+import io.atomix.copycat.server.storage.Storage;
+import io.atomix.copycat.server.storage.StorageLevel;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.component.atomix.cluster.AtomixClusterConfiguration;
+import org.apache.camel.ha.CamelCluster;
+import org.apache.camel.ha.CamelClusterService;
+import org.apache.camel.ha.CamelClusterView;
+import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.CamelContextHelper;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ResourceHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AtomixClusterService extends ServiceSupport implements CamelContextAware, CamelClusterService {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AtomixClusterService.class);
+
+ private final AtomixClusterConfiguration configuration;
+
+ private CamelContext camelContext;
+ private Address address;
+ private AtomixCluster cluster;
+
+ public AtomixClusterService() {
+ this.configuration = new AtomixClusterConfiguration();
+ }
+
+ // **********************************
+ // Properties
+ // **********************************
+
+ @Override
+ public CamelContext getCamelContext() {
+ return camelContext;
+ }
+
+ @Override
+ public void setCamelContext(CamelContext camelContext) {
+ this.camelContext = camelContext;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = new Address(address);
+ }
+
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+
+ public String getStoragePath() {
+ return configuration.getStoragePath();
+ }
+
+ public void setStoragePath(String storagePath) {
+ configuration.setStoragePath(storagePath);
+ }
+
+ public List<Address> getNodes() {
+ return configuration.getNodes();
+ }
+
+ public StorageLevel getStorageLevel() {
+ return configuration.getStorageLevel();
+ }
+
+ public void setNodes(List<Address> nodes) {
+ configuration.setNodes(nodes);
+ }
+
+ public void setStorageLevel(StorageLevel storageLevel) {
+ configuration.setStorageLevel(storageLevel);
+ }
+
+ public void setNodes(String nodes) {
+ configuration.setNodes(nodes);
+ }
+
+ public Class<? extends Transport> getTransport() {
+ return configuration.getTransport();
+ }
+
+ public void setTransport(Class<? extends Transport> transport) {
+ configuration.setTransport(transport);
+ }
+
+ public String getReplicaRef() {
+ return configuration.getReplicaRef();
+ }
+
+ /**
+ * Set the reference of an instance of {@link AtomixReplica}.
+ * @param clusterref
+ */
+ public void setReplicaRef(String clusterref) {
+ configuration.setReplicaRef(clusterref);
+ }
+
+ public Atomix getReplica() {
+ return configuration.getReplica();
+ }
+
+ /**
+ * Set an instance of {@link AtomixReplica}.
+ * @param replica
+ */
+ public void setReplica(AtomixReplica replica) {
+ configuration.setReplica(replica);
+ }
+
+ public String getConfigurationUri() {
+ return configuration.getConfigurationUri();
+ }
+
+ public void setConfigurationUri(String configurationUri) {
+ configuration.setConfigurationUri(configurationUri);
+ }
+
+ // **********************************
+ // Cluster
+ // **********************************
+
+ @Override
+ public synchronized CamelCluster getCluster() throws Exception {
+ if (this.cluster == null) {
+ AtomixReplica atomix = configuration.getReplica();
+
+ if (atomix == null) {
+ if (configuration.getReplicaRef() != null) {
+ atomix = CamelContextHelper.mandatoryLookup(camelContext, configuration.getReplicaRef(), AtomixReplica.class);
+ } else {
+ ObjectHelper.notNull(this.address, "Atomix Address");
+
+ final AtomixReplica.Builder atomixBuilder;
+
+ String uri = configuration.getConfigurationUri();
+ if (ObjectHelper.isNotEmpty(uri)) {
+ uri = camelContext.resolvePropertyPlaceholders(uri);
+ try (InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, uri)) {
+ Properties properties = new Properties();
+ properties.load(is);
+
+ atomixBuilder = AtomixReplica.builder(this.address, properties);
+ }
+ } else {
+ atomixBuilder = AtomixReplica.builder(this.address);
+ }
+
+ Storage.Builder storageBuilder = Storage.builder();
+ ObjectHelper.ifNotEmpty(configuration.getStorageLevel(), storageBuilder::withStorageLevel);
+ ObjectHelper.ifNotEmpty(configuration.getStoragePath(), storageBuilder::withDirectory);
+
+ atomixBuilder.withStorage(storageBuilder.build());
+
+ if (configuration.getTransport() != null) {
+ atomixBuilder.withTransport(
+ camelContext.getInjector().newInstance(configuration.getTransport())
+ );
+ }
+
+ atomix = atomixBuilder.build();
+ }
+ }
+
+ this.cluster = new AtomixCluster(atomix, configuration.getNodes());
+ this.cluster.setCamelContext(camelContext);
+ }
+
+ return this.cluster;
+ }
+
+ @Override
+ public CamelClusterView createView(String namespace) throws Exception {
+ return getCluster().createView(namespace);
+ }
+
+ // **********************************
+ // Service
+ // **********************************
+
+ @Override
+ protected void doStart() throws Exception {
+ LOGGER.debug("Starting cluster on address {}", address);
+ getCluster().start();
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ if (this.cluster != null) {
+ this.cluster.stop();
+ this.cluster = null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
index 6c8f9e5..bf1c4d1 100644
--- a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
@@ -20,41 +20,51 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
+import io.atomix.Atomix;
import io.atomix.group.DistributedGroup;
import io.atomix.group.GroupMember;
import io.atomix.group.LocalMember;
+import io.atomix.group.election.Term;
import org.apache.camel.ha.CamelClusterMember;
import org.apache.camel.ha.CamelClusterView;
import org.apache.camel.impl.ha.AbstractCamelClusterView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class AtomixClusterView extends AbstractCamelClusterView {
+public final class AtomixClusterView extends AbstractCamelClusterView {
private static final Logger LOGGER = LoggerFactory.getLogger(AtomixClusterView.class);
- private final DistributedGroup group;
+ private final Atomix atomix;
private final AtomixLocalMember localMember;
+ private DistributedGroup group;
- AtomixClusterView(AtomixCluster cluster, String namespace, DistributedGroup group) {
+ AtomixClusterView(AtomixCluster cluster, String namespace, Atomix atomix) {
super(cluster, namespace);
- this.group = group;
- this.localMember = new AtomixLocalMember(group);
+ this.atomix = atomix;
+ this.localMember = new AtomixLocalMember();
}
@Override
public CamelClusterMember getMaster() {
- return asCamelClusterMember(this.group.election().term().leader());
+ if (group == null) {
+ throw new IllegalStateException("The view has not yet joined the cluster");
+ }
+
+ return asCamelClusterMember(group.election().term().leader());
}
@Override
public CamelClusterMember getLocalMember() {
- return this.localMember;
+ return localMember;
}
@Override
public List<CamelClusterMember> getMembers() {
- // TODO: Dummy implementation for testing purpose
+ if (group == null) {
+ throw new IllegalStateException("The view has not yet joined the cluster");
+ }
+
return this.group.members().stream()
.map(this::asCamelClusterMember)
.collect(Collectors.toList());
@@ -66,11 +76,15 @@ public class AtomixClusterView extends AbstractCamelClusterView {
@Override
protected void doStart() throws Exception {
- if (!this.localMember.hasJoined()) {
- this.localMember.join();
- this.group.election().onElection(
- t -> fireEvent(CamelClusterView.Event.LEADERSHIP_CHANGED, asCamelClusterMember(t.leader()))
- );
+ if (!localMember.hasJoined()) {
+ LOGGER.debug("Get group {}", getNamespace());
+ group = this.atomix.getGroup(getNamespace()).get();
+
+ LOGGER.debug("Join group {}", getNamespace());
+ localMember.join();
+
+ LOGGER.debug("Listen election events");
+ group.election().onElection(this::onElection);
}
}
@@ -79,22 +93,24 @@ public class AtomixClusterView extends AbstractCamelClusterView {
localMember.leave();
}
+ private void onElection(Term term) {
+ fireEvent(CamelClusterView.Event.LEADERSHIP_CHANGED, asCamelClusterMember(term.leader()));
+ }
+
// ***********************************************
//
// ***********************************************
class AtomixLocalMember implements CamelClusterMember {
- private final DistributedGroup group;
private LocalMember member;
- AtomixLocalMember(DistributedGroup group) {
- this.group = group;
+ AtomixLocalMember() {
}
@Override
public String getId() {
if (member == null) {
- throw new IllegalStateException("Cluster not yet joined");
+ throw new IllegalStateException("The view has not yet joined the cluster");
}
return member.id();
@@ -114,9 +130,9 @@ public class AtomixClusterView extends AbstractCamelClusterView {
}
AtomixLocalMember join() throws ExecutionException, InterruptedException {
- if (member == null) {
+ if (member == null && group != null) {
LOGGER.debug("Joining group {}", group);
- member = this.group.join().get();
+ member = group.join().join();
}
return this;
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix b/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix
deleted file mode 100644
index d4f1673..0000000
--- a/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-#class=org.apache.camel.component.atomix.AtomixComponent
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix-client
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix-client b/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix-client
new file mode 100644
index 0000000..5e7a620
--- /dev/null
+++ b/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix-client
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.atomix.AtomixClientComponent
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix-cluster
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix-cluster b/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix-cluster
new file mode 100644
index 0000000..57df716
--- /dev/null
+++ b/components/camel-atomix/src/main/resources/META-INF/services/org/apache/camel/component/atomix-cluster
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.atomix.AtomixClusterComponent
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/components/camel-atomix/src/test/java/org/apache/camel/component/atomix/ha/AtomixRoutePolicyMain.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/test/java/org/apache/camel/component/atomix/ha/AtomixRoutePolicyMain.java b/components/camel-atomix/src/test/java/org/apache/camel/component/atomix/ha/AtomixRoutePolicyMain.java
index 0a126d3..e622900 100644
--- a/components/camel-atomix/src/test/java/org/apache/camel/component/atomix/ha/AtomixRoutePolicyMain.java
+++ b/components/camel-atomix/src/test/java/org/apache/camel/component/atomix/ha/AtomixRoutePolicyMain.java
@@ -17,27 +17,17 @@
package org.apache.camel.component.atomix.ha;
import java.io.File;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import io.atomix.Atomix;
-import io.atomix.AtomixReplica;
import io.atomix.catalyst.transport.Address;
-import io.atomix.catalyst.transport.netty.NettyTransport;
-import io.atomix.copycat.server.storage.Storage;
import io.atomix.copycat.server.storage.StorageLevel;
-import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.ha.CamelCluster;
+import org.apache.camel.ha.CamelClusterService;
import org.apache.camel.ha.CamelClusterView;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.ha.ClusteredRoutePolicy;
import org.apache.camel.spi.RoutePolicy;
-import org.apache.camel.test.AvailablePortFinder;
import org.apache.camel.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,90 +35,62 @@ import org.slf4j.LoggerFactory;
public final class AtomixRoutePolicyMain {
private static final Logger LOGGER = LoggerFactory.getLogger(AtomixRoutePolicyMain.class);
-
- private static final List<Address> ADDRESSES = Arrays.asList(
- new Address("127.0.0.1", AvailablePortFinder.getNextAvailable()),
- new Address("127.0.0.1", AvailablePortFinder.getNextAvailable()),
- new Address("127.0.0.1", AvailablePortFinder.getNextAvailable())
- );
-
- private static final CountDownLatch LATCH = new CountDownLatch(ADDRESSES.size());
- private static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(ADDRESSES.size() * 2);
-
public static void main(final String[] args) throws Exception {
- for (Address address : ADDRESSES) {
- EXECUTOR.submit(() -> run(address));
- }
-
- LATCH.await();
-
- System.exit(0);
- }
-
- static void run(Address address) {
- try {
- final String id = String.format("atomix-%d", address.port());
- final File path = new File("target", id);
-
- // Cleanup
- FileUtil.removeDir(path);
+ String[] addresses = System.getProperty("atomix.cluster").split(",");
- Atomix atomix = AtomixReplica.builder(address)
- .withTransport(new NettyTransport())
- .withStorage(
- Storage.builder()
- .withDirectory(path)
- .withStorageLevel(StorageLevel.MEMORY)
- .build())
- .build()
- .bootstrap(ADDRESSES)
- .join();
-
- CountDownLatch latch = new CountDownLatch(1);
- CamelContext context = new DefaultCamelContext();
- CamelCluster cluster = new AtomixCluster(atomix);
- CamelClusterView view = cluster.createView("my-view");
-
- view.addEventListener((e, p) -> {
- if (view.getLocalMember().isMaster()) {
- LOGGER.info("Member {} ({}), is now master", view.getLocalMember().getId(), address);
-
- // Shutdown the context later on so the next one should take
- // the leadership
- EXECUTOR.schedule(latch::countDown, 10, TimeUnit.SECONDS);
- }
- });
-
- context.addService(cluster);
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- RoutePolicy policy = ClusteredRoutePolicy.forView(view);
+ List<Address> cluster = new ArrayList<>();
+ for (int i = 0; i < addresses.length; i++) {
+ String[] parts = addresses[i].split(":");
+ cluster.add(new Address(parts[0], Integer.valueOf(parts[1])));
+ }
- fromF("timer:%s-1?period=2s", id)
- .routeId(id + "-1")
- .routePolicy(policy)
- .setHeader("ClusterMaster")
- .body(b -> view.getMaster().getId())
- .log("${routeId} (1) - master is: ${header.ClusterMaster}");
- fromF("timer:%s-2?period=5s", id)
- .routeId(id + "-2")
- .routePolicy(policy)
- .setHeader("ClusterMaster")
- .body(b -> view.getMaster().getId())
- .log("${routeId} (2) - master is: ${header.ClusterMaster}");
+ final String id = String.format("atomix-%d", cluster.get(0).port());
+ final File path = new File("target", id);
+
+ // Cleanup
+ FileUtil.removeDir(path);
+
+ AtomixClusterService service = new AtomixClusterService();
+ service.setStoragePath(path.getAbsolutePath());
+ service.setStorageLevel(StorageLevel.DISK);
+ service.setAddress(cluster.get(0));
+ service.setNodes(cluster);
+
+ DefaultCamelContext context = new DefaultCamelContext();
+ context.addService(service);
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ CamelClusterService cluster = getContext().hasService(AtomixClusterService.class);
+ CamelClusterView view = cluster.createView("my-view");
+ RoutePolicy policy = ClusteredRoutePolicy.forView(view);
+
+ fromF("timer:%s-1?period=2s", id)
+ .routeId(id + "-1")
+ .routePolicy(policy)
+ .log("${routeId} (1)");
+ fromF("timer:%s-2?period=5s", id)
+ .routeId(id + "-2")
+ .routePolicy(policy)
+ .log("${routeId} (2)");
+ }
+ });
+
+ context.start();
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ try {
+ context.stop();
+ } catch (Exception e) {
+ LOGGER.warn("", e);
}
- });
+ }
+ });
- context.start();
- latch.await();
- context.stop();
-
- LATCH.countDown();
- } catch (Exception e) {
- throw new RuntimeException(e);
+ for (int i = 0; i < Integer.MAX_VALUE; i++) {
+ Thread.sleep(1000);
}
-
- LOGGER.info("Done {}", address);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/platforms/spring-boot/components-starter/camel-atomix-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-atomix-starter/pom.xml b/platforms/spring-boot/components-starter/camel-atomix-starter/pom.xml
new file mode 100644
index 0000000..b3231a5
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-atomix-starter/pom.xml
@@ -0,0 +1,53 @@
+<?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</groupId>
+ <artifactId>components-starter</artifactId>
+ <version>2.20.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>camel-atomix-starter</artifactId>
+ <packaging>jar</packaging>
+ <name>Spring-Boot Starter :: Camel :: Atomix</name>
+ <description>Spring-Boot Starter for Camel Atomix support</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>${spring-boot-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-atomix</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--START OF GENERATED CODE-->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ </dependency>
+ <!--END OF GENERATED CODE-->
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/spring.provides
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..26745eb
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-atomix-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+provides: camel-atomix
http://git-wip-us.apache.org/repos/asf/camel/blob/14f88f2e/platforms/spring-boot/components-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index 4bca7c5..35fc760 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -83,6 +83,7 @@
<module>camel-atmos-starter</module>
<module>camel-atmosphere-websocket-starter</module>
<module>camel-atom-starter</module>
+ <module>camel-atomix-starter</module>
<module>camel-avro-starter</module>
<module>camel-aws-starter</module>
<module>camel-azure-starter</module>