Announcement Announcement Module
Collapse
No announcement yet.
Message Flow v/s Workflow Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Message Flow v/s Workflow

    if i have a workflow kind of functionality why i should use any workflow systems like jBPM or spring workflow , but i can use spring integration with Endpoints calling any services etc which does the same thing what any workflow does ? i appreciate any inputs/advice on this

  • #2
    Actually you right on the money with your comparison. For most cases developers would try to use workflow engines to implement simple EIP style processes and then realize that for a simple tasks workflow engines are a bit too heavy and that framework like Spring Integration is a much lighter alternative. However Workflow engines would fit nicely in the scope of Process Manager pattern - http://www.eaipatterns.com/ProcessManager.html where message flows might be long lived and running with long pauses in between. For example you can check Spring Integration integration with Activity workflow engine

    Comment


    • #3
      Oleg,
      I am also interested to use the Activiti Workflow engine as Spring Integration Process manager pattern. What is the right approach to get started with it? Can you provide some pointers?
      Thanks.

      Comment


      • #4
        Hi krassib, there is currently support for using Activiti as a process manager (and more): http://git.springsource.org/spring-i...ation-activiti this code supports two use cases:
        - process manager (e.g, launching processes when a message is received). There is support for sending message headers back and forth as process variables, etc, too.
        - letting Spring integration do the heavy lifting when an activiti process reaches a certain state. (in this setup, the activiti process "sends" an inbound message to your Spring Integration code through an inbound Activiti gateway. You then have the ability to react to the message and do whatever you'd like in response to the state change. Finally, once you've completed doing whatever integration logic you'd like from Spring Integration, you can send a reply message, causing the business process to resume (essentially, it "signals" the process). Note when Activiti 'hands off' the state to Spring Integration, it passivates, so there's no state kept or anything, and it thus doesn't matter if you return immediately, or a year later. It's asynchronous and respects the contract of a workflow state.

        Both use cases are demonstrated in the test cases in that code I linked you too. The code itself has achieved a fair amount of stability / maturation, though if you encounter any problems or have any questions, please feel free to post back here and we'll happily follow up.

        Comment


        • #5
          Hi Josh,
          Thanks for replying back! I cloned a copy of the spring-integration (from here git://git.springsource.org/spring-integration/sandbox.git). Do you have some instructions on how to setup and run the activiti tests/samples from within STS 2.7.2 (I am pretty new to Activiti)? I would like to do some load tests (performance evaluation) on some Activiti workflows and see if they would fit into my company business need.

          Krassimir

          Comment


          • #6
            Hi There,

            Activiti requires you to setup the database schema that it needs to work. It will do this for you automatically based on how you configure the ProcessEngine. In the code in the sandbox, the examples are just simple unit tests that defer to Spring configuration to do the setup of the ProcessEngine itself. The ProcessEngine in all (most?) of the examples lives in http://git.springsource.org/spring-i...iguration.java. Modify the processEngine bean and modfy getDatabaseSchemaUpdate to the value as appropriate for you.

            Other than that, you should just be able to run the code as a unit test or a main method. There's no particular middle ware or infrastructure or server that's required besides that.

            Comment


            • #7
              Hi Josh,

              What happens if the activiti process in a waiting state (expecting a message from SI) goes down? Would the state be persisted, so that after a restart of the process the workflow will resume from the last persisted (long) waiting state?

              Also what is your suggestion on monitoring activiti processes? Do you have some examples?

              Thanks,
              Krassimir

              Comment


              • #8
                Hi Josh,

                I was trying to run the use case 1 above (e.g, launching processes when a message is received) - ProcessStartingOutboundAdapterTest class

                Code:
                /* Licensed 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.springframework.integration.activiti.adapter;
                
                import org.activiti.engine.ProcessEngine;
                import org.junit.Test;
                import org.junit.runner.RunWith;
                import org.springframework.beans.factory.annotation.Autowired;
                import org.springframework.beans.factory.annotation.Value;
                import org.springframework.integration.Message;
                import org.springframework.integration.MessageChannel;
                import org.springframework.integration.activiti.ActivitiConstants;
                import org.springframework.integration.activiti.test.AbstractSpringIntegrationActivitiTestCase;
                import org.springframework.integration.core.MessagingTemplate;
                import org.springframework.integration.support.MessageBuilder;
                import org.springframework.test.context.ContextConfiguration;
                import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
                
                @ContextConfiguration("ProcessStartingOutboundChannelAdapterTest-context.xml")
                @RunWith(SpringJUnit4ClassRunner.class)
                public class ProcessStartingOutboundAdapterTest extends AbstractSpringIntegrationActivitiTestCase {
                
                    @Value("#{triggerChannel}")
                    private MessageChannel messageChannel;
                    @Autowired ProcessEngine pe;
                    private MessagingTemplate messagingTemplate = new MessagingTemplate();
                
                    @Test
                    public void testOutboundAdapter() throws Throwable {
                
                        pe.getRepositoryService().createDeployment().addClasspathResource("processes/hello.bpmn20.xml").deploy();
                
                        Message<?> msg = MessageBuilder.withPayload("hello, from " + System.currentTimeMillis())
                                                 .setHeader(ActivitiConstants.WELL_KNOWN_PROCESS_DEFINITION_NAME_HEADER_KEY, "hello")
                                                 .build();
                        messagingTemplate.send(this.messageChannel, msg);
                    }
                
                }
                , but somehow the Activiti groovy script was not executed:


                Code:
                   <scriptTask id="helloScriptTask" name="Execute script" scriptFormat="groovy">
                      <script><![CDATA[out:println "**** hello world! ****";]]></script>
                   </scriptTask>


                Could you give me some pointers how to troubleshoot.

                Thanks and appreciate your time in helping with this,
                Krassimir

                Originally posted by joshlong View Post
                Hi krassib, there is currently support for using Activiti as a process manager (and more): http://git.springsource.org/spring-i...ation-activiti this code supports two use cases:
                - process manager (e.g, launching processes when a message is received). There is support for sending message headers back and forth as process variables, etc, too.
                - letting Spring integration do the heavy lifting when an activiti process reaches a certain state. (in this setup, the activiti process "sends" an inbound message to your Spring Integration code through an inbound Activiti gateway. You then have the ability to react to the message and do whatever you'd like in response to the state change. Finally, once you've completed doing whatever integration logic you'd like from Spring Integration, you can send a reply message, causing the business process to resume (essentially, it "signals" the process). Note when Activiti 'hands off' the state to Spring Integration, it passivates, so there's no state kept or anything, and it thus doesn't matter if you return immediately, or a year later. It's asynchronous and respects the contract of a workflow state.

                Both use cases are demonstrated in the test cases in that code I linked you too. The code itself has achieved a fair amount of stability / maturation, though if you encounter any problems or have any questions, please feel free to post back here and we'll happily follow up.
                Last edited by krassib; Jan 17th, 2012, 12:09 PM.

                Comment

                Working...
                X