3 Replies Latest reply on Sep 17, 2009 9:33 AM by Joram Barrez

    command service

    Sofie Ravyts Newbie

      This might be a very easy question to solve , but I can't find the solution (or maybe I'm completely missing the ball here...)

      I'm trying to create my own custom query (MyQuery which extends AbstractQuery).
      Now is my problem: how can I execute this query?

      I was thinking calling processEngine.execute(query) (since AbstractQuery implements the Command interface), but I can't succeed in getting a processEngine (I'm using spring integration)

      If I autowire processengine I get the following error:

      Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.jbpm.api.ProcessEngine] is defined: expected single matching bean but found 2: [jbpmConfiguration, processEngine]
      


      This is my spring configuration:

      <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
       <constructor-arg value="org/mypackage/jbpm.cfg.xml" />
       </bean>
      
       <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
       <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
       <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
       <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
       <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
       <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
      
       <bean id="queryExecutor" class="org.mypackage.QueryExecutor" />
      
      
      


      And QueryExecutor :

      public class QueryExecutor
      {
       @Autowired
       ProcessEngine processEngine
      
       public List query(MyQuery query){
       return processEngine.execute(query);
       }
      }
      



      Is there another way for executing commands using spring integration?
      Or aren't we supposed to execute commands?

      Wkr,
      Sofie