This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch cloud2 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2589de7f0a7fd85d7423275e24d870d374e68403 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Apr 5 17:33:25 2019 +0200 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress --- .../camel/impl/cloud/DefaultServiceCallProcessor.java | 8 ++++++-- .../apache/camel/cloud/aggregating-service-discovery | 17 +++++++++++++++++ .../org/apache/camel/cloud/blacklist-service-filter | 17 +++++++++++++++++ .../org/apache/camel/cloud/caching-service-discovery | 17 +++++++++++++++++ .../org/apache/camel/cloud/chained-service-filter | 17 +++++++++++++++++ .../org/apache/camel/cloud/combined-service-discovery | 17 +++++++++++++++++ .../org/apache/camel/cloud/combined-service-filter | 17 +++++++++++++++++ .../apache/camel/cloud/default-service-load-balancer | 17 +++++++++++++++++ .../org/apache/camel/cloud/healthy-service-filter | 17 +++++++++++++++++ .../org/apache/camel/cloud/pass-through-service-filter | 17 +++++++++++++++++ .../org/apache/camel/cloud/static-service-discovery | 17 +++++++++++++++++ .../org/apache/camel/impl/DefaultProcessorFactory.java | 1 + .../org/apache/camel/impl/DefaultProducerCache.java | 2 +- 13 files changed, 178 insertions(+), 3 deletions(-) diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java index 9218ce9..5ff978b 100644 --- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java +++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java @@ -210,7 +210,11 @@ public class DefaultServiceCallProcessor extends AsyncProcessorSupport { * @return the computed expression */ private static String applySimpleLanguage(String expression, Exchange exchange) { - Language simple = exchange.getContext().resolveLanguage("simple"); - return simple.createExpression(expression).evaluate(exchange, String.class); + if (expression != null) { + Language simple = exchange.getContext().resolveLanguage("simple"); + return simple.createExpression(expression).evaluate(exchange, String.class); + } else { + return null; + } } } diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/aggregating-service-discovery b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/aggregating-service-discovery new file mode 100644 index 0000000..675af88 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/aggregating-service-discovery @@ -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. +# +class=org.apache.camel.impl.cloud.AggregatingServiceDiscoveryFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/blacklist-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/blacklist-service-filter new file mode 100644 index 0000000..29ee4e6 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/blacklist-service-filter @@ -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. +# +class=org.apache.camel.impl.cloud.BlacklistServiceFilterFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/caching-service-discovery b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/caching-service-discovery new file mode 100644 index 0000000..7a57359 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/caching-service-discovery @@ -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. +# +class=org.apache.camel.impl.cloud.CachingServiceDiscoveryFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/chained-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/chained-service-filter new file mode 100644 index 0000000..6eb18b5 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/chained-service-filter @@ -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. +# +class=org.apache.camel.impl.cloud.ChainedServiceFilterFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-discovery b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-discovery new file mode 100644 index 0000000..67efb31 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-discovery @@ -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. +# +class=org.apache.camel.impl.cloud.CombinedServiceDiscoveryFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-filter new file mode 100644 index 0000000..68cdfc2 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-filter @@ -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. +# +class=org.apache.camel.impl.cloud.CombinedServiceFilterFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/default-service-load-balancer b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/default-service-load-balancer new file mode 100644 index 0000000..16644c8 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/default-service-load-balancer @@ -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. +# +class=org.apache.camel.impl.cloud.DefaultServiceLoadBalancerFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/healthy-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/healthy-service-filter new file mode 100644 index 0000000..b1cdd65 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/healthy-service-filter @@ -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. +# +class=org.apache.camel.impl.cloud.HealthyServiceFilterFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/pass-through-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/pass-through-service-filter new file mode 100644 index 0000000..e1e1912 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/pass-through-service-filter @@ -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. +# +class=org.apache.camel.impl.cloud.PassThroughServiceFilterFactory \ No newline at end of file diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/static-service-discovery b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/static-service-discovery new file mode 100644 index 0000000..5d2f763 --- /dev/null +++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/static-service-discovery @@ -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. +# +class=org.apache.camel.impl.cloud.StaticServiceDiscoveryFactory \ No newline at end of file diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java index a9c18c8..c26b895 100644 --- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java +++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java @@ -91,6 +91,7 @@ public class DefaultProcessorFactory implements ProcessorFactory { Expression expression = (Expression) args.get("expression"); ExchangePattern pattern = (ExchangePattern) args.get("exchangePattern"); answer = new SendDynamicProcessor(uri, expression); + answer.setCamelContext(camelContext); if (pattern != null) { answer.setPattern(pattern); } diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java index 04b1723..48c1494 100644 --- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java +++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java @@ -60,7 +60,7 @@ public class DefaultProducerCache extends ServiceSupport implements ProducerCach this.producers = new ServicePool<>(Endpoint::createAsyncProducer, AsyncProducer::getEndpoint, maxCacheSize); // only if JMX is enabled - if (camelContext.getManagementStrategy().getManagementAgent() != null) { + if (camelContext.getManagementStrategy() != null && camelContext.getManagementStrategy().getManagementAgent() != null) { this.extendedStatistics = camelContext.getManagementStrategy().getManagementAgent().getStatisticsLevel().isExtended(); } else { this.extendedStatistics = false;
