Gary Hodgson created CAMEL-11382:
------------------------------------

             Summary: Creating IgniteComponent from Ignite Instance throws 
IllegalStateException
                 Key: CAMEL-11382
                 URL: https://issues.apache.org/jira/browse/CAMEL-11382
             Project: Camel
          Issue Type: Bug
          Components: camel-ignite
    Affects Versions: 2.19.0
            Reporter: Gary Hodgson
            Priority: Minor


Creating an IgniteComponent from configuration works fine, but when I try and 
create one from an existing Ignite instance it throws an exception when 
starting the component.  Looking at the code 
[here|https://github.com/apache/camel/blob/master/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java#L77]
 it appears the lifecycleMode is ignored as it is only set to COMPONENT_MANAGED 
and cannot be altered outside of the class.  

The following patch sets the lifecycleMode USER_MANAGED when an ignite instance 
is set, which appears to resolve the problem.
{code}
  diff --git 
a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java
 
b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java
  index eaf6583..e9efc79 100644
  --- 
a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java
  +++ 
b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java
  @@ -121,6 +108,7 @@
        */
       public void setIgnite(Ignite ignite) {
           this.ignite = ignite;
  +        lifecycleMode = IgniteLifecycleMode.USER_MANAGED;
       }
   
       /**
{code}

(github pull request to follow)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to