You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/11/13 11:23:30 UTC
[camel] branch main updated (0e5e24c -> cd3f56f)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.
from 0e5e24c CAMEL-17185 Add an option for customizing retryable PubSub server errors (#6413)
new 9939227 CAMEL-17190: Polished
new b0ddb85 CAMEL-17190: camel-quickfix - Use ref counters to keep track on engine usage, and stop engine when no longer in use. And start if needed, such as manually stop a route and then later start it again.
new e6eea2f Regen
new abde1cd camel-core - Fixed NPE in Recipient List EIP
new cd3f56f CAMEL-17190: camel-quickfix - Use ref counters to keep track on engine usage, and stop engine when no longer in use. And start if needed, such as manually stop a route and then later start it again.
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../camel/catalog/components/google-pubsub.json | 1 +
.../apache/camel/catalog/components/quickfix.json | 4 +-
.../quickfixj/QuickfixjEndpointConfigurer.java | 4 +-
.../apache/camel/component/quickfixj/quickfix.json | 4 +-
.../component/quickfixj/QuickfixjComponent.java | 11 +++-
.../component/quickfixj/QuickfixjEndpoint.java | 74 ++++++++++++++++------
.../camel/component/quickfixj/QuickfixjEngine.java | 26 +++++++-
.../component/quickfixj/QuickfixjProducer.java | 16 ++++-
.../quickfixj/QuickfixjComponentTest.java | 8 +--
.../component/quickfixj/QuickfixjProducerTest.java | 2 +-
...sagingExample.java => RestartRouteExample.java} | 58 ++++++++---------
.../camel/processor/RecipientListProcessor.java | 4 +-
.../dsl/QuickfixjEndpointBuilderFactory.java | 69 +++-----------------
13 files changed, 151 insertions(+), 130 deletions(-)
copy components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/{SimpleMessagingExample.java => RestartRouteExample.java} (60%)
[camel] 05/05: CAMEL-17190: camel-quickfix - Use ref counters to keep track on engine usage, and stop engine when no longer in use. And start if needed, such as manually stop a route and then later start it again.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit cd3f56ff718cb806c3e83781356068afaebd3b2d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Nov 13 12:22:34 2021 +0100
CAMEL-17190: camel-quickfix - Use ref counters to keep track on engine usage, and stop engine when no longer in use. And start if needed, such as manually stop a route and then later start it again.
---
.../quickfixj/examples/RestartRouteExample.java | 104 +++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RestartRouteExample.java b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RestartRouteExample.java
new file mode 100644
index 0000000..62b6db0
--- /dev/null
+++ b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RestartRouteExample.java
@@ -0,0 +1,104 @@
+/*
+ * 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.quickfixj.examples;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.quickfixj.QuickfixjEndpoint;
+import org.apache.camel.component.quickfixj.TestSupport;
+import org.apache.camel.component.quickfixj.examples.util.CountDownLatchDecrementer;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import quickfix.field.MsgType;
+import quickfix.fix42.Email;
+
+/**
+ * Stopping a route should stop engine if no longer in use. And starting the route should start engine again.
+ */
+public class RestartRouteExample {
+ private static final Logger LOG = LoggerFactory.getLogger(RestartRouteExample.class);
+
+ public static void main(String[] args) throws Exception {
+ new RestartRouteExample().sendMessage();
+ }
+
+ public void sendMessage() throws Exception {
+ DefaultCamelContext context = new DefaultCamelContext();
+
+ final CountDownLatch receivedMessageLatch = new CountDownLatch(2);
+
+ RouteBuilder routes = new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("quickfix:examples/inprocess.cfg?sessionID=FIX.4.2:MARKET->TRADER").routeId("foo")
+ .filter(header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.EMAIL))
+ .bean(new CountDownLatchDecrementer("message", receivedMessageLatch));
+ }
+ };
+
+ context.addRoutes(routes);
+
+ LOG.info("Starting Camel context");
+ context.start();
+
+ String marketUri = "quickfix:examples/inprocess.cfg?sessionID=FIX.4.2:TRADER->MARKET";
+ Producer producer = context.getEndpoint(marketUri).createProducer();
+
+ Email email = TestSupport.createEmailMessage("Example");
+ Exchange exchange = producer.getEndpoint().createExchange(ExchangePattern.InOnly);
+ exchange.getIn().setBody(email);
+ producer.process(exchange);
+
+ // wait a little before stopping
+ Thread.sleep(5000);
+
+ // stop route
+ context.getRouteController().stopRoute("foo");
+
+ // wait a little before starting
+ Thread.sleep(5000);
+
+ // start route again
+ context.getRouteController().startRoute("foo");
+
+ // wait a little before sending
+ Thread.sleep(5000);
+
+ // send another email
+ producer = context.getEndpoint(marketUri).createProducer();
+ email = TestSupport.createEmailMessage("Example2");
+ exchange = producer.getEndpoint().createExchange(ExchangePattern.InOnly);
+ exchange.getIn().setBody(email);
+ producer.process(exchange);
+
+ if (!receivedMessageLatch.await(30L, TimeUnit.SECONDS)) {
+ throw new IllegalStateException("Message did not reach market");
+ }
+
+ LOG.info("Message received, shutting down Camel context");
+
+ context.stop();
+
+ LOG.info("Example complete");
+ }
+}
[camel] 01/05: CAMEL-17190: Polished
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9939227a99e75e171b71b7262d561b66c6dd021f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Nov 13 10:58:07 2021 +0100
CAMEL-17190: Polished
---
.../apache/camel/component/quickfixj/QuickfixjEngine.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
index efb92da..a00cba8 100644
--- a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
+++ b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
@@ -93,13 +93,13 @@ public class QuickfixjEngine extends ServiceSupport {
private LogFactory sessionLogFactory;
private MessageFactory messageFactory;
private final MessageCorrelator messageCorrelator = new MessageCorrelator();
- private List<QuickfixjEventListener> eventListeners = new CopyOnWriteArrayList<>();
+ private final List<QuickfixjEventListener> eventListeners = new CopyOnWriteArrayList<>();
private final String uri;
private ObjectName acceptorObjectName;
private ObjectName initiatorObjectName;
private final SessionSettings settings;
private final AtomicBoolean initialized = new AtomicBoolean();
- private boolean lazy;
+ private final boolean lazy;
public enum ThreadModel {
ThreadPerConnector,
@@ -161,6 +161,9 @@ public class QuickfixjEngine extends ServiceSupport {
void initializeEngine()
throws ConfigError,
FieldConvertError, JMException {
+
+ LOG.debug("Initializing QuickFIX/J Engine");
+
if (messageFactory == null) {
messageFactory = new DefaultMessageFactory();
}
@@ -223,6 +226,8 @@ public class QuickfixjEngine extends ServiceSupport {
} finally {
Thread.currentThread().setContextClassLoader(ccl);
}
+
+ LOG.debug("Initialized QuickFIX/J Engine acceptor: {}, initiator: {}", acceptor, initiator);
initialized.set(true);
}
@@ -233,6 +238,8 @@ public class QuickfixjEngine extends ServiceSupport {
@Override
protected void doStart() throws Exception {
+ LOG.debug("Starting QuickFIX/J Engine acceptor: {}, initiator: {}", acceptor, initiator);
+
if (acceptor != null) {
acceptor.start();
if (jmxExporter != null) {
@@ -249,6 +256,8 @@ public class QuickfixjEngine extends ServiceSupport {
@Override
protected void doStop() throws Exception {
+ LOG.debug("Stopping QuickFIX/J Engine acceptor: {}, initiator: {}", acceptor, initiator);
+
if (acceptor != null) {
acceptor.stop();
[camel] 02/05: CAMEL-17190: camel-quickfix - Use ref counters to keep track on engine usage, and stop engine when no longer in use. And start if needed, such as manually stop a route and then later start it again.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b0ddb853caa4fc75ef9b2f818499c0a984075b58
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Nov 13 11:44:24 2021 +0100
CAMEL-17190: camel-quickfix - Use ref counters to keep track on engine usage, and stop engine when no longer in use. And start if needed, such as manually stop a route and then later start it again.
---
.../apache/camel/catalog/components/quickfix.json | 4 +-
.../quickfixj/QuickfixjEndpointConfigurer.java | 4 +-
.../apache/camel/component/quickfixj/quickfix.json | 4 +-
.../component/quickfixj/QuickfixjComponent.java | 11 +++-
.../component/quickfixj/QuickfixjEndpoint.java | 74 ++++++++++++++++------
.../camel/component/quickfixj/QuickfixjEngine.java | 21 ++++--
.../component/quickfixj/QuickfixjProducer.java | 16 ++++-
.../quickfixj/QuickfixjComponentTest.java | 8 +--
.../component/quickfixj/QuickfixjProducerTest.java | 2 +-
.../dsl/QuickfixjEndpointBuilderFactory.java | 69 +++-----------------
10 files changed, 113 insertions(+), 100 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/quickfix.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/quickfix.json
index 3d7ad38..09798ed 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/quickfix.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/quickfix.json
@@ -32,8 +32,8 @@
},
"properties": {
"configurationName": { "kind": "path", "displayName": "Configuration Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Path to the quickfix configuration file. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the configuration file using these protocols (classpath is default). ref will lookup [...]
- "lazyCreateEngine": { "kind": "parameter", "displayName": "Lazy Create Engine", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "This option allows to create QuickFIX\/J engine on demand. Value true means the engine is started when first message is send or there's consumer configured in route definition. When false value is used, the engine is s [...]
- "sessionID": { "kind": "parameter", "displayName": "Session ID", "group": "common", "label": "", "required": false, "type": "object", "javaType": "quickfix.SessionID", "deprecated": false, "autowired": false, "secret": false, "description": "The optional sessionID identifies a specific FIX session. The format of the sessionID is: (BeginString):(SenderCompID)\/(SenderSubID)\/(SenderLocationID)-(TargetCompID)\/(TargetSubID)\/(TargetLocationID)" },
+ "lazyCreateEngine": { "kind": "parameter", "displayName": "Lazy Create Engine", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "This option allows creating QuickFIX\/J engine on demand. Value true means the engine is started when first message is send or there's consumer configured in route definition. When false value is used, the engine is st [...]
+ "sessionID": { "kind": "parameter", "displayName": "Session ID", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional sessionID identifies a specific FIX session. The format of the sessionID is: (BeginString):(SenderCompID)\/(SenderSubID)\/(SenderLocationID)-(TargetCompID)\/(TargetSubID)\/(TargetLocationID)" },
"bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 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 m [...]
"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, "autowired": 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 con [...]
"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, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
diff --git a/components/camel-quickfix/src/generated/java/org/apache/camel/component/quickfixj/QuickfixjEndpointConfigurer.java b/components/camel-quickfix/src/generated/java/org/apache/camel/component/quickfixj/QuickfixjEndpointConfigurer.java
index 41853af..6db203c 100644
--- a/components/camel-quickfix/src/generated/java/org/apache/camel/component/quickfixj/QuickfixjEndpointConfigurer.java
+++ b/components/camel-quickfix/src/generated/java/org/apache/camel/component/quickfixj/QuickfixjEndpointConfigurer.java
@@ -32,7 +32,7 @@ public class QuickfixjEndpointConfigurer extends PropertyConfigurerSupport imple
case "lazystartproducer":
case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
case "sessionid":
- case "sessionID": target.setSessionID(property(camelContext, quickfix.SessionID.class, value)); return true;
+ case "sessionID": target.setSessionID(property(camelContext, java.lang.String.class, value)); return true;
default: return false;
}
}
@@ -51,7 +51,7 @@ public class QuickfixjEndpointConfigurer extends PropertyConfigurerSupport imple
case "lazystartproducer":
case "lazyStartProducer": return boolean.class;
case "sessionid":
- case "sessionID": return quickfix.SessionID.class;
+ case "sessionID": return java.lang.String.class;
default: return null;
}
}
diff --git a/components/camel-quickfix/src/generated/resources/org/apache/camel/component/quickfixj/quickfix.json b/components/camel-quickfix/src/generated/resources/org/apache/camel/component/quickfixj/quickfix.json
index 3d7ad38..09798ed 100644
--- a/components/camel-quickfix/src/generated/resources/org/apache/camel/component/quickfixj/quickfix.json
+++ b/components/camel-quickfix/src/generated/resources/org/apache/camel/component/quickfixj/quickfix.json
@@ -32,8 +32,8 @@
},
"properties": {
"configurationName": { "kind": "path", "displayName": "Configuration Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Path to the quickfix configuration file. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the configuration file using these protocols (classpath is default). ref will lookup [...]
- "lazyCreateEngine": { "kind": "parameter", "displayName": "Lazy Create Engine", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "This option allows to create QuickFIX\/J engine on demand. Value true means the engine is started when first message is send or there's consumer configured in route definition. When false value is used, the engine is s [...]
- "sessionID": { "kind": "parameter", "displayName": "Session ID", "group": "common", "label": "", "required": false, "type": "object", "javaType": "quickfix.SessionID", "deprecated": false, "autowired": false, "secret": false, "description": "The optional sessionID identifies a specific FIX session. The format of the sessionID is: (BeginString):(SenderCompID)\/(SenderSubID)\/(SenderLocationID)-(TargetCompID)\/(TargetSubID)\/(TargetLocationID)" },
+ "lazyCreateEngine": { "kind": "parameter", "displayName": "Lazy Create Engine", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "This option allows creating QuickFIX\/J engine on demand. Value true means the engine is started when first message is send or there's consumer configured in route definition. When false value is used, the engine is st [...]
+ "sessionID": { "kind": "parameter", "displayName": "Session ID", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional sessionID identifies a specific FIX session. The format of the sessionID is: (BeginString):(SenderCompID)\/(SenderSubID)\/(SenderLocationID)-(TargetCompID)\/(TargetSubID)\/(TargetLocationID)" },
"bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 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 m [...]
"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, "autowired": 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 con [...]
"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, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
diff --git a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
index 318341e..66afb63 100644
--- a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
+++ b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
@@ -26,6 +26,7 @@ import org.apache.camel.StartupListener;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.support.service.ServiceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import quickfix.LogFactory;
@@ -144,7 +145,7 @@ public class QuickfixjComponent extends DefaultComponent implements StartupListe
private void startQuickfixjEngine(QuickfixjEngine engine) {
if (!engine.isLazy()) {
LOG.info("Starting QuickFIX/J engine: {}", engine.getUri());
- engine.start();
+ ServiceHelper.startService(engine);
} else {
LOG.info("QuickFIX/J engine: {} will start lazily", engine.getUri());
}
@@ -229,4 +230,12 @@ public class QuickfixjComponent extends DefaultComponent implements StartupListe
provisionalEngines.clear();
}
}
+
+ public void ensureEngineStarted(QuickfixjEngine engine) {
+ // only start engine after provisional engines is no longer in use
+ // as they are used for holding created engines during bootstrap of Camel
+ if (provisionalEngines.isEmpty()) {
+ ServiceHelper.startService(engine);
+ }
+ }
}
diff --git a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java
index 41eb763..3851fac 100644
--- a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java
+++ b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEndpoint.java
@@ -33,6 +33,7 @@ import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
import org.apache.camel.support.DefaultEndpoint;
+import org.apache.camel.support.service.ServiceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import quickfix.Message;
@@ -58,7 +59,8 @@ public class QuickfixjEndpoint extends DefaultEndpoint implements QuickfixjEvent
@Metadata(required = true)
private String configurationName;
@UriParam
- private SessionID sessionID;
+ private String sessionID;
+ private volatile SessionID sid;
@UriParam
private boolean lazyCreateEngine;
@@ -67,16 +69,26 @@ public class QuickfixjEndpoint extends DefaultEndpoint implements QuickfixjEvent
this.engine = engine;
}
- public SessionID getSessionID() {
+ @Override
+ public QuickfixjComponent getComponent() {
+ return (QuickfixjComponent) super.getComponent();
+ }
+
+ public String getSessionID() {
return sessionID;
}
+ public SessionID getSID() {
+ return sid;
+ }
+
/**
* The optional sessionID identifies a specific FIX session. The format of the sessionID is:
* (BeginString):(SenderCompID)[/(SenderSubID)[/(SenderLocationID)]]->(TargetCompID)[/(TargetSubID)[/(TargetLocationID)]]
*/
- public void setSessionID(SessionID sessionID) {
+ public void setSessionID(String sessionID) {
this.sessionID = sessionID;
+ this.sid = new SessionID(sessionID);
}
public String getConfigurationName() {
@@ -100,7 +112,7 @@ public class QuickfixjEndpoint extends DefaultEndpoint implements QuickfixjEvent
}
/**
- * This option allows to create QuickFIX/J engine on demand. Value true means the engine is started when first
+ * This option allows creating QuickFIX/J engine on demand. Value true means the engine is started when first
* message is send or there's consumer configured in route definition. When false value is used, the engine is
* started at the endpoint creation. When this parameter is missing, the value of component's property
* lazyCreateEngines is being used.
@@ -129,10 +141,30 @@ public class QuickfixjEndpoint extends DefaultEndpoint implements QuickfixjEvent
protected void addConsumer(QuickfixjConsumer consumer) {
consumers.add(consumer);
+ engine.incRefCount();
+ getComponent().ensureEngineStarted(engine);
}
protected void removeConsumer(QuickfixjConsumer consumer) {
consumers.remove(consumer);
+ int count = engine.decRefCount();
+ if (count <= 0) {
+ LOG.info("Stopping QuickFIX/J Engine: {} no longer active in use", engine.getUri());
+ ServiceHelper.stopService(engine);
+ }
+ }
+
+ protected void addProducer(QuickfixjProducer producer) {
+ engine.incRefCount();
+ getComponent().ensureEngineStarted(engine);
+ }
+
+ protected void removeProducer(QuickfixjProducer producer) {
+ int count = engine.decRefCount();
+ if (count <= 0) {
+ LOG.info("Stopping QuickFIX/J Engine: {} no longer active in use", engine.getUri());
+ ServiceHelper.stopService(engine);
+ }
}
@Override
@@ -155,16 +187,16 @@ public class QuickfixjEndpoint extends DefaultEndpoint implements QuickfixjEvent
}
private boolean isMatching(SessionID sessionID) {
- if (this.sessionID.equals(sessionID)) {
+ if (this.sid.equals(sessionID)) {
return true;
}
- return isMatching(this.sessionID.getBeginString(), sessionID.getBeginString())
- && isMatching(this.sessionID.getSenderCompID(), sessionID.getSenderCompID())
- && isMatching(this.sessionID.getSenderSubID(), sessionID.getSenderSubID())
- && isMatching(this.sessionID.getSenderLocationID(), sessionID.getSenderLocationID())
- && isMatching(this.sessionID.getTargetCompID(), sessionID.getTargetCompID())
- && isMatching(this.sessionID.getTargetSubID(), sessionID.getTargetSubID())
- && isMatching(this.sessionID.getTargetLocationID(), sessionID.getTargetLocationID());
+ return isMatching(this.sid.getBeginString(), sessionID.getBeginString())
+ && isMatching(this.sid.getSenderCompID(), sessionID.getSenderCompID())
+ && isMatching(this.sid.getSenderSubID(), sessionID.getSenderSubID())
+ && isMatching(this.sid.getSenderLocationID(), sessionID.getSenderLocationID())
+ && isMatching(this.sid.getTargetCompID(), sessionID.getTargetCompID())
+ && isMatching(this.sid.getTargetSubID(), sessionID.getTargetSubID())
+ && isMatching(this.sid.getTargetLocationID(), sessionID.getTargetLocationID());
}
private boolean isMatching(String s1, String s2) {
@@ -172,16 +204,16 @@ public class QuickfixjEndpoint extends DefaultEndpoint implements QuickfixjEvent
}
private boolean isWildcarded() {
- if (sessionID == null) {
+ if (sid == null) {
return false;
}
- return sessionID.getBeginString().equals("*")
- || sessionID.getSenderCompID().equals("*")
- || sessionID.getSenderSubID().equals("*")
- || sessionID.getSenderLocationID().equals("*")
- || sessionID.getTargetCompID().equals("*")
- || sessionID.getTargetSubID().equals("*")
- || sessionID.getTargetLocationID().equals("*");
+ return sid.getBeginString().equals("*")
+ || sid.getSenderCompID().equals("*")
+ || sid.getSenderSubID().equals("*")
+ || sid.getSenderLocationID().equals("*")
+ || sid.getTargetCompID().equals("*")
+ || sid.getTargetSubID().equals("*")
+ || sid.getTargetLocationID().equals("*");
}
@Override
@@ -197,7 +229,7 @@ public class QuickfixjEndpoint extends DefaultEndpoint implements QuickfixjEvent
synchronized (engine) {
if (!engine.isInitialized()) {
engine.initializeEngine();
- engine.start();
+ ServiceHelper.startService(engine);
}
}
}
diff --git a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
index a00cba8..0e7ec75 100644
--- a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
+++ b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.management.JMException;
import javax.management.ObjectName;
@@ -30,6 +31,7 @@ import javax.management.ObjectName;
import org.apache.camel.CamelContext;
import org.apache.camel.support.ResourceHelper;
import org.apache.camel.support.service.ServiceSupport;
+import org.apache.camel.util.URISupport;
import org.quickfixj.jmx.JmxExporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -100,6 +102,7 @@ public class QuickfixjEngine extends ServiceSupport {
private final SessionSettings settings;
private final AtomicBoolean initialized = new AtomicBoolean();
private final boolean lazy;
+ private final AtomicInteger refCount = new AtomicInteger();
public enum ThreadModel {
ThreadPerConnector,
@@ -134,7 +137,7 @@ public class QuickfixjEngine extends ServiceSupport {
boolean lazy) throws Exception {
addEventListener(messageCorrelator);
- this.uri = uri;
+ this.uri = URISupport.sanitizeUri(uri);
this.lazy = lazy;
this.settings = settings;
@@ -154,6 +157,14 @@ public class QuickfixjEngine extends ServiceSupport {
}
}
+ public int incRefCount() {
+ return refCount.incrementAndGet();
+ }
+
+ public int decRefCount() {
+ return refCount.decrementAndGet();
+ }
+
/**
* Initializes the engine on demand. May be called immediately in constructor or when needed. If initializing later,
* it should be started afterwards.
@@ -162,7 +173,7 @@ public class QuickfixjEngine extends ServiceSupport {
throws ConfigError,
FieldConvertError, JMException {
- LOG.debug("Initializing QuickFIX/J Engine");
+ LOG.debug("Initializing QuickFIX/J Engine: {}", uri);
if (messageFactory == null) {
messageFactory = new DefaultMessageFactory();
@@ -227,7 +238,7 @@ public class QuickfixjEngine extends ServiceSupport {
Thread.currentThread().setContextClassLoader(ccl);
}
- LOG.debug("Initialized QuickFIX/J Engine acceptor: {}, initiator: {}", acceptor, initiator);
+ LOG.debug("Initialized QuickFIX/J Engine: {}", uri);
initialized.set(true);
}
@@ -238,7 +249,7 @@ public class QuickfixjEngine extends ServiceSupport {
@Override
protected void doStart() throws Exception {
- LOG.debug("Starting QuickFIX/J Engine acceptor: {}, initiator: {}", acceptor, initiator);
+ LOG.debug("Starting QuickFIX/J Engine: {}", uri);
if (acceptor != null) {
acceptor.start();
@@ -256,7 +267,7 @@ public class QuickfixjEngine extends ServiceSupport {
@Override
protected void doStop() throws Exception {
- LOG.debug("Stopping QuickFIX/J Engine acceptor: {}, initiator: {}", acceptor, initiator);
+ LOG.debug("Stopping QuickFIX/J Engine: {}", uri);
if (acceptor != null) {
acceptor.stop();
diff --git a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjProducer.java b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjProducer.java
index 59c363a..8738792 100644
--- a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjProducer.java
+++ b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjProducer.java
@@ -44,6 +44,18 @@ public class QuickfixjProducer extends DefaultProducer {
}
@Override
+ protected void doStart() throws Exception {
+ getEndpoint().addProducer(this);
+ super.doStart();
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ getEndpoint().removeProducer(this);
+ super.doStop();
+ }
+
+ @Override
public void process(Exchange exchange) throws Exception {
try {
getEndpoint().ensureInitialized();
@@ -57,7 +69,7 @@ public class QuickfixjProducer extends DefaultProducer {
Message message = camelMessage.getBody(Message.class);
LOG.debug("Sending FIX message: {}", message);
- SessionID messageSessionID = getEndpoint().getSessionID();
+ SessionID messageSessionID = getEndpoint().getSID();
if (messageSessionID == null) {
messageSessionID = MessageUtils.getSessionID(message);
}
@@ -71,7 +83,7 @@ public class QuickfixjProducer extends DefaultProducer {
if (exchange.getPattern().isOutCapable()) {
MessageCorrelator messageCorrelator = getEndpoint().getEngine().getMessageCorrelator();
- callable = messageCorrelator.getReply(getEndpoint().getSessionID(), exchange);
+ callable = messageCorrelator.getReply(getEndpoint().getSID(), exchange);
}
if (!session.send(message)) {
diff --git a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjComponentTest.java b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjComponentTest.java
index bc8857c..97659c4 100644
--- a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjComponentTest.java
+++ b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjComponentTest.java
@@ -173,7 +173,7 @@ public class QuickfixjComponentTest {
assertThat(component.getProvisionalEngines().get(settingsFile.getName()).isInitialized(), is(true));
assertThat(component.getProvisionalEngines().get(settingsFile.getName()).isStarted(), is(false));
assertThat(component.getEngines().size(), is(0));
- assertThat(((QuickfixjEndpoint) e1).getSessionID(), is(nullValue()));
+ assertThat(((QuickfixjEndpoint) e1).getSID(), is(nullValue()));
writeSettings(settings, false);
@@ -184,7 +184,7 @@ public class QuickfixjComponentTest {
assertThat(component.getProvisionalEngines().get(settingsFile.getName()).isInitialized(), is(true));
assertThat(component.getProvisionalEngines().get(settingsFile.getName()).isStarted(), is(false));
assertThat(component.getEngines().size(), is(0));
- assertThat(((QuickfixjEndpoint) e2).getSessionID(), is(nullValue()));
+ assertThat(((QuickfixjEndpoint) e2).getSID(), is(nullValue()));
// will start the component
camelContext.start();
@@ -219,7 +219,7 @@ public class QuickfixjComponentTest {
assertThat(component.getEngines().get(settingsFile.getName()).isInitialized(), is(true));
assertThat(component.getEngines().get(settingsFile.getName()).isStarted(), is(true));
assertThat(component.getProvisionalEngines().size(), is(0));
- assertThat(((QuickfixjEndpoint) e1).getSessionID(), is(nullValue()));
+ assertThat(((QuickfixjEndpoint) e1).getSID(), is(nullValue()));
Endpoint e2 = component.createEndpoint(getEndpointUri(settingsFile.getName(), sessionID));
assertThat(component.getEngines().size(), is(1));
@@ -227,7 +227,7 @@ public class QuickfixjComponentTest {
assertThat(component.getEngines().get(settingsFile.getName()).isInitialized(), is(true));
assertThat(component.getEngines().get(settingsFile.getName()).isStarted(), is(true));
assertThat(component.getProvisionalEngines().size(), is(0));
- assertThat(((QuickfixjEndpoint) e2).getSessionID(), is(sessionID));
+ assertThat(((QuickfixjEndpoint) e2).getSID(), is(sessionID));
}
@Test
diff --git a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
index f783ca6..ff084b6 100644
--- a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
+++ b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjProducerTest.java
@@ -70,7 +70,7 @@ public class QuickfixjProducerTest {
Mockito.when(mockCamelMessage.getBody(Message.class)).thenReturn(inboundFixMessage);
- Mockito.when(mockEndpoint.getSessionID()).thenReturn(sessionID);
+ Mockito.when(mockEndpoint.getSID()).thenReturn(sessionID);
producer = Mockito.spy(new QuickfixjProducer(mockEndpoint));
}
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/QuickfixjEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/QuickfixjEndpointBuilderFactory.java
index a97c3e6..8ff6026 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/QuickfixjEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/QuickfixjEndpointBuilderFactory.java
@@ -43,7 +43,7 @@ public interface QuickfixjEndpointBuilderFactory {
return (AdvancedQuickfixjEndpointConsumerBuilder) this;
}
/**
- * This option allows to create QuickFIX/J engine on demand. Value true
+ * This option allows creating QuickFIX/J engine on demand. Value true
* means the engine is started when first message is send or there's
* consumer configured in route definition. When false value is used,
* the engine is started at the endpoint creation. When this parameter
@@ -64,7 +64,7 @@ public interface QuickfixjEndpointBuilderFactory {
return this;
}
/**
- * This option allows to create QuickFIX/J engine on demand. Value true
+ * This option allows creating QuickFIX/J engine on demand. Value true
* means the engine is started when first message is send or there's
* consumer configured in route definition. When false value is used,
* the engine is started at the endpoint creation. When this parameter
@@ -90,24 +90,7 @@ public interface QuickfixjEndpointBuilderFactory {
* of the sessionID is:
* (BeginString):(SenderCompID)/(SenderSubID)/(SenderLocationID)-(TargetCompID)/(TargetSubID)/(TargetLocationID).
*
- * The option is a: <code>quickfix.SessionID</code> type.
- *
- * Group: common
- *
- * @param sessionID the value to set
- * @return the dsl builder
- */
- default QuickfixjEndpointConsumerBuilder sessionID(Object sessionID) {
- doSetProperty("sessionID", sessionID);
- return this;
- }
- /**
- * The optional sessionID identifies a specific FIX session. The format
- * of the sessionID is:
- * (BeginString):(SenderCompID)/(SenderSubID)/(SenderLocationID)-(TargetCompID)/(TargetSubID)/(TargetLocationID).
- *
- * The option will be converted to a
- * <code>quickfix.SessionID</code> type.
+ * The option is a: <code>java.lang.String</code> type.
*
* Group: common
*
@@ -256,7 +239,7 @@ public interface QuickfixjEndpointBuilderFactory {
return (AdvancedQuickfixjEndpointProducerBuilder) this;
}
/**
- * This option allows to create QuickFIX/J engine on demand. Value true
+ * This option allows creating QuickFIX/J engine on demand. Value true
* means the engine is started when first message is send or there's
* consumer configured in route definition. When false value is used,
* the engine is started at the endpoint creation. When this parameter
@@ -277,7 +260,7 @@ public interface QuickfixjEndpointBuilderFactory {
return this;
}
/**
- * This option allows to create QuickFIX/J engine on demand. Value true
+ * This option allows creating QuickFIX/J engine on demand. Value true
* means the engine is started when first message is send or there's
* consumer configured in route definition. When false value is used,
* the engine is started at the endpoint creation. When this parameter
@@ -303,24 +286,7 @@ public interface QuickfixjEndpointBuilderFactory {
* of the sessionID is:
* (BeginString):(SenderCompID)/(SenderSubID)/(SenderLocationID)-(TargetCompID)/(TargetSubID)/(TargetLocationID).
*
- * The option is a: <code>quickfix.SessionID</code> type.
- *
- * Group: common
- *
- * @param sessionID the value to set
- * @return the dsl builder
- */
- default QuickfixjEndpointProducerBuilder sessionID(Object sessionID) {
- doSetProperty("sessionID", sessionID);
- return this;
- }
- /**
- * The optional sessionID identifies a specific FIX session. The format
- * of the sessionID is:
- * (BeginString):(SenderCompID)/(SenderSubID)/(SenderLocationID)-(TargetCompID)/(TargetSubID)/(TargetLocationID).
- *
- * The option will be converted to a
- * <code>quickfix.SessionID</code> type.
+ * The option is a: <code>java.lang.String</code> type.
*
* Group: common
*
@@ -404,7 +370,7 @@ public interface QuickfixjEndpointBuilderFactory {
return (AdvancedQuickfixjEndpointBuilder) this;
}
/**
- * This option allows to create QuickFIX/J engine on demand. Value true
+ * This option allows creating QuickFIX/J engine on demand. Value true
* means the engine is started when first message is send or there's
* consumer configured in route definition. When false value is used,
* the engine is started at the endpoint creation. When this parameter
@@ -425,7 +391,7 @@ public interface QuickfixjEndpointBuilderFactory {
return this;
}
/**
- * This option allows to create QuickFIX/J engine on demand. Value true
+ * This option allows creating QuickFIX/J engine on demand. Value true
* means the engine is started when first message is send or there's
* consumer configured in route definition. When false value is used,
* the engine is started at the endpoint creation. When this parameter
@@ -451,24 +417,7 @@ public interface QuickfixjEndpointBuilderFactory {
* of the sessionID is:
* (BeginString):(SenderCompID)/(SenderSubID)/(SenderLocationID)-(TargetCompID)/(TargetSubID)/(TargetLocationID).
*
- * The option is a: <code>quickfix.SessionID</code> type.
- *
- * Group: common
- *
- * @param sessionID the value to set
- * @return the dsl builder
- */
- default QuickfixjEndpointBuilder sessionID(Object sessionID) {
- doSetProperty("sessionID", sessionID);
- return this;
- }
- /**
- * The optional sessionID identifies a specific FIX session. The format
- * of the sessionID is:
- * (BeginString):(SenderCompID)/(SenderSubID)/(SenderLocationID)-(TargetCompID)/(TargetSubID)/(TargetLocationID).
- *
- * The option will be converted to a
- * <code>quickfix.SessionID</code> type.
+ * The option is a: <code>java.lang.String</code> type.
*
* Group: common
*
[camel] 03/05: Regen
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit e6eea2fc6f4b92b28e00136f34373e505999a42f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Nov 13 11:44:35 2021 +0100
Regen
---
.../resources/org/apache/camel/catalog/components/google-pubsub.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-pubsub.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-pubsub.json
index 12d1223..aaba5a0 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-pubsub.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-pubsub.json
@@ -26,6 +26,7 @@
"endpoint": { "kind": "property", "displayName": "Endpoint", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Endpoint to use with local Pub\/Sub emulator." },
"serviceAccountKey": { "kind": "property", "displayName": "Service Account Key", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The Service account key that can be used as credentials for the PubSub publisher\/subscriber. It can be loaded by default from classpath, but you can prefix with classpath:, file:, or http: to load the resource from different [...]
"bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 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 me [...]
+ "synchronousPullRetryableCodes": { "kind": "property", "displayName": "Synchronous Pull Retryable Codes", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Comma-separated list of additional retryable error codes for synchronous pull. By default the PubSub client library retries ABORTED, UNAVAILABLE, UNKNOWN" },
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 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 star [...]
"publisherCacheSize": { "kind": "property", "displayName": "Publisher Cache Size", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "Maximum number of producers to cache. This could be increased if you have producers for lots of different topics." },
"publisherCacheTimeout": { "kind": "property", "displayName": "Publisher Cache Timeout", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "How many milliseconds should each producer stay alive in the cache." },
[camel] 04/05: camel-core - Fixed NPE in Recipient List EIP
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit abde1cd224dfda4a33f65c9403340e589a6068a6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Nov 13 11:59:36 2021 +0100
camel-core - Fixed NPE in Recipient List EIP
---
.../main/java/org/apache/camel/processor/RecipientListProcessor.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/RecipientListProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/RecipientListProcessor.java
index 20665d1..1c472d4 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/RecipientListProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/RecipientListProcessor.java
@@ -218,9 +218,7 @@ public class RecipientListProcessor extends MulticastProcessor {
index = doCreateProcessorExchangePairs(exchange, recipient, result, index);
}
return result;
- } else if (recipientList.getClass().isArray()) {
- // TODO upper checks against instanceof do not cause NullPointerException,
- // but here we potentially get it because of de-referencing
+ } else if (recipientList != null && recipientList.getClass().isArray()) {
Object[] arr = (Object[]) recipientList;
int size = Array.getLength(recipientList);
List<ProcessorExchangePair> result = new ArrayList<>(size);