10 Replies Latest reply on Jul 8, 2015 10:15 AM by rajkumar0809

    Invoking services dynamically

    calca

      Hi Guys,

       

      I have the following scenario. I have my custom bean implementation which creates a KnowledgeSession, and use it for drools and jbpm. I was not able to use the out of the box because we need it to be quite custom.

       

      I would like to be able to use the feature of using the Switchyard Service task node in my BPMN. But for this, I will need to register the SwitchYardServiceTaskHandler manually. Basically this handler is just an invoker, which receives some service name and operation, and executes it.

      I have seen that, for making it work, it need a SwitchYardServiceInvoker, which needs a ServiceDomain. Do you know where I could get this?

       

      Thanks in advance!

       

      Demian

        • 1. Re: Invoking services dynamically
          wsimons

          here is the chapter on custom service task handler  Chapter 21. Domain-specific Processes

           

          jbpm is basically a event or command  see 5.3.2 java always uses listeners

           

          Chapter 5. Core Engine API

          finally if you are using rest api  http://blog.eisele.net/2015/01/kickstart-on-api-management-with-jboss-apiman.html

          you can use a signal inside your application http://www.infoq.com/articles/boris-lublinsky-jboss-jbpm

          Chapter 17. Remote API under 17.2.1.1 please notice you can make remote signal (event)calls with rest api

           

          web api is a great resource for java in other words if you can figure out the spring framework and activiti

          than you should be able to use jbpm switchyard java(weld) while it may not be exactly the same

          once you figured out one you should be able to figure out the other. I own activemq, jbpm 5 books

          manning and spring integration aprèss (the greatest book on middleware)  

          I do know that rest api is the recommended way to go with jbpm.                

          • 2. Re: Invoking services dynamically
            calca

            Hi William. Thanks for your response.

             

            I know how to create jbpm work item handlers.

             

            I am just trying to figure out how to create one that can call dynamically switchyard services...

             

            Thanks again,

             

            Demian

            • 3. Re: Invoking services dynamically
              wsimons

              http://jboss-overlord.blogspot.com/

               

              Chapter 1. Introduction to DTGovdid you look into this guide

              also I see api is supported

              • 4. Re: Invoking services dynamically
                wsimons

                FuseServiceWorksByExample/Home-Loan-Reference-Architecture · GitHub

                 

                I am really interested in governance architecture

                Ibm uses this so I would be interested what you think

                • 5. Re: Invoking services dynamically
                  kcbabo

                  Demian - not sure you want to go down this path, but I can point in you in the right direction and you can determine for yourself.  If you have a bean implementation, you can get access to the ServiceDomain by injecting an instance of Exchange and grabbing the reference from there, e.g.

                   

                  @Inject
                  private Exchange exchange;
                  
                  public void myOperation(String msg) {
                    ServiceDomain domain = exchange.getProvider().getDomain();
                    // do stuff with domain here
                  }
                  
                  • 6. Re: Invoking services dynamically
                    calca

                    Hey Keith.

                     

                    Basically, what I want to do is the same that it is done currently in the bpm service provided by SY, where you have a BPM node where you configure the service to invoke and you can use the BPM service to orchestate different services.

                     

                    In my case, I could not use the provided BPM service, as I have something quite custom, where in the knowledge session (the drools & jbpm one), I have to dynamically add rules and also add processes. So I went for creating a custom service implementation. But in this service, I would still want to have the funcionality of calling SY services from my bpm processes.

                     

                    In this case, I need to register a work item handler like SwitchYardServiceTaskHandler, which basically receives a service name, operation and parameters, and calls a SY service. I want to do the same, but to make SwitchYardServiceTaskHandler to work, I need to create it with a SwitchYardServiceInvoker instance, and this class needs

                    public class SwitchYardServiceInvoker {

                        private final ServiceDomain _serviceDomain;

                        private final String _targetNamespace;

                     

                    Does it make sense? Do you see any simpler solution for this?

                     

                    Thanks,

                     

                    Demian

                    • 7. Re: Invoking services dynamically
                      kcbabo

                      Yep, I get what you are trying to do.  Just pointing out that we didn't originally design the task handler to be used outside the BPM component so you may hit other issues beyond just getting access to the ServiceDomain.

                      • 8. Re: Invoking services dynamically
                        calca

                        Yes, I imagine this, I will try with this and see. In the mean while I just used custom jbpm nodes so I can live with this.

                         

                        Thanks Keith!

                         

                        Demian

                        • 9. Re: Invoking services dynamically
                          synclpz

                          Hi Demian!

                           

                          Did you achieved any success with your custom jBPM service? Especially in terms of executing SY services? And also with runtime process add/removal, performance?

                          Some time ago I tried to use SY's jBPM component but it was not working smoothly, so we decided not to use jBPM. There were problems with process designer, with invoking services and exception handling. Also the performance was very low (200-500 simple processes per sec on 2x8 core Xeon with 32GB RAM).

                          • 10. Re: Invoking services dynamically
                            rajkumar0809

                            Hi,

                             

                            Anyone Suggest me to Triggering the Workflow From Queue (ActiveMQ or Rabbitmq) ?