4 Replies Latest reply on Mar 31, 2015 4:28 AM by c00823ue

    How can I change RuntimeEnvironment without restarting wildfly-8.1.0.Final?

    c00823ue

      I create RuntimeEnvironment by RuntimeEnvironmentBuilder.

       

          @Produces
          @Singleton
          @PerProcessInstance
          @PerRequest
          public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) {
           
              AbstractAuditLogger auditlogger = null;
             
              RuntimeEnvironmentBuilder a  = RuntimeEnvironmentBuilder
                      .getDefault()
                      .entityManagerFactory(emf)
                      .userGroupCallback(usergroupCallback)
                      .registerableItemsFactory(InjectableRegisterableItemsFactory.getFactory(beanManager, auditlogger));
                      
              a.addAsset(ResourceFactory.newClassPathResource("rewards.bpmn"),ResourceType.BPMN2);
             RuntimeEnvironment environment = a.get();
         
             
              ((SimpleRegisterableItemsFactory) environment.getRegisterableItemsFactory()).addWorkItemHandler("xx", handler.TestWorkItemHandler1.class);
             
              return environment;
          }
      
      

       

      I create TaskService and RuntimeManager by cdi.

      @Inject
      @PerRequest
      private RuntimeManager manager;
      
      

       

      @Inject
      TaskService taskService;
      
      

       

       

      I found out that produceEnvironment function is not called when I start a new process.

      In ths case, everytime I want to add a new bpmn file I need to restart wildfly-8.1.0.Final. How can I avoid that?

      Thanks!