diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java b/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java index 4a6f506a77..a47c28dbff 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java @@ -47,7 +47,10 @@ public class ActiveMQComponent extends JmsComponent { */ public static ActiveMQComponent activeMQComponent(String brokerURL) { ActiveMQComponent answer = new ActiveMQComponent(); - answer.getConfiguration().setBrokerURL(brokerURL); + if (answer.getConfiguration() instanceof ActiveMQConfiguration) { + ((ActiveMQConfiguration) answer.getConfiguration()) + .setBrokerURL(brokerURL); + } return answer; } @@ -62,21 +65,23 @@ public class ActiveMQComponent extends JmsComponent { super(configuration); } - @Override - public ActiveMQConfiguration getConfiguration() { - return (ActiveMQConfiguration) super.getConfiguration(); - } - + public void setBrokerURL(String brokerURL) { - getConfiguration().setBrokerURL(brokerURL); + if (getConfiguration() instanceof ActiveMQConfiguration) { + ((ActiveMQConfiguration)getConfiguration()).setBrokerURL(brokerURL); + } } public void setUserName(String userName) { - getConfiguration().setUserName(userName); + if (getConfiguration() instanceof ActiveMQConfiguration) { + ((ActiveMQConfiguration)getConfiguration()).setUserName(userName); + } } public void setPassword(String password) { - getConfiguration().setPassword(password); + if (getConfiguration() instanceof ActiveMQConfiguration) { + ((ActiveMQConfiguration)getConfiguration()).setPassword(password); + } } public boolean isExposeAllQueues() { @@ -94,11 +99,15 @@ public class ActiveMQComponent extends JmsComponent { } public void setUsePooledConnection(boolean usePooledConnection) { - getConfiguration().setUsePooledConnection(usePooledConnection); + if (getConfiguration() instanceof ActiveMQConfiguration) { + ((ActiveMQConfiguration)getConfiguration()).setUsePooledConnection(usePooledConnection); + } } public void setUseSingleConnection(boolean useSingleConnection) { - getConfiguration().setUseSingleConnection(useSingleConnection); + if (getConfiguration() instanceof ActiveMQConfiguration) { + ((ActiveMQConfiguration)getConfiguration()).setUseSingleConnection(useSingleConnection); + } } @Override diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java b/activemq-core/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java index 1a4481b1fd..d761b3f95f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java +++ b/activemq-core/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java @@ -118,8 +118,10 @@ public class CamelEndpointLoader implements InitializingBean, DisposableBean, Ca } public ConnectionFactory getConnectionFactory() { - if (connectionFactory == null) { - connectionFactory = getComponent().getConfiguration().createConnectionFactory(); + if (connectionFactory == null + && getComponent().getConfiguration() instanceof ActiveMQConfiguration) { + connectionFactory = ((ActiveMQConfiguration) getComponent() + .getConfiguration()).createConnectionFactory(); } return connectionFactory; }