10 Replies Latest reply on Jul 28, 2014 5:31 PM by quirozariel21

    How to set UserGroupCallback for Human Task Service client

    katis

      Hello,

       

      I've implemented custom UserGroupCallback for my service, but I cannot get TaskClient to query this implementation. I've tried setting "jbpm.usergroup.callback" system property, but no luck here.

      How shoudl I inform TaskClient of my UserGroupCallback?

       

      I've searched forum for this information, but all links to examples or documentation are invalid...

       

      Thanks for any hints,

      Katarzyna

        • 1. Re: How to set UserGroupCallback for Human Task Service client
          swiderski.maciej

          there is no need to inform task client about the callback implementation. It is only relevant to the task service side. Not sure how do you use task service but there are several ways of doing that:

          • using web application - from 5.3 there is a human task web application that exposes ht features of hornetq by default, it is configurable via web.xml and its init parameters
          • programatically - UserGroupCallbackManager is responsible for callback registration
          • using system properties - use -Djbpm.usergroup.callback=[your custom callback class name] - note that your class must have default constructor
          • using property file - use simple property file that will hold a single line (or more depending on callback implementation) to bootstrap it when callback manager is initiated
            • file name: jbpm.usergroup.callback.properties
            • property name: jbpm.usergroup.callback=your custom class name
            • location: org/jbpm/task/identity/ on your classpath

           

          HTH

          • 2. Re: How to set UserGroupCallback for Human Task Service client
            a_nat

            Hi Maciej,

             

            I guess just one of these configurations won't suffice. Suppose you have the defeult implementation i.e., human task war, I had to do both of these configurations to get my File based user group callback implementation to work.

             

            * modify the web.xml

            * Include the system property.

             

            Am I correct?

             

            Regards,

            Ana

            • 3. Re: How to set UserGroupCallback for Human Task Service client
              swiderski.maciej

              Specifying it in web.xml should be enough unless there is that default propery file available as web.xml value is set only if there is no other callback registered already. So I can imagine situation that callback manager found the property file first and registered default one and web.xml value is skipped. So please ensure that the default property file is not there. If you find it somewhere in the packages shipped with jBPM please file a jira issue for that to be cleaned up.

               

              Thanks

              • 4. Re: How to set UserGroupCallback for Human Task Service client
                katis

                Thanks for suggestions - so now I have to figure out how am I using Human Task Service Lack of documentation here isn't helpfull at all - for now I'm just starting demo services from jBPM 5.3 installer (ant tasks "start.demo.noeclipse" + "start.human.task"). This is serving default HTS functionality for my PoC application, where I'm connecting to HTS with this code:

                 

                MinaTaskClientHandler handler = new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener());
                client = new TaskClient(new MinaTaskClientConnector(communityId.toString(), handler));
                client.connect("127.0.0.1", 9123);
                

                 

                ... so I assume, I'm using HTS as a WebService, right?

                 

                If I got your answer right UserGroupCallback runs on HT service side, so I'm not sure if it suits my needs. My client is a Liferay portlet, which means it runs in external permission system, based on users and groups. The use case is I create and run processes (of human tasks) from this portlet, using Liferay user and group IDs. In portlet each user can check if there are any tasks for them (also basing on group membership). In Liferay user can belong to many groups and, of course, group membership can be (have to be) determined on portlet (Liferay) side in running server's context.

                 

                This implies that UserGroupCallback implementation must be running on Liferay (client side...), which - as you said - is not the way to do it.

                 

                Any suggestions on how to accomplish this task are welcomed. Maybe running HTS inside Liferay (Tomcat) is a solution here?

                • 5. Re: How to set UserGroupCallback for Human Task Service client
                  swiderski.maciej

                  Katarzyna Bylec wrote:

                   

                  Thanks for suggestions - so now I have to figure out how am I using Human Task Service Lack of documentation here isn't helpfull at all - for now I'm just starting demo services from jBPM 5.3 installer (ant tasks "start.demo.noeclipse" + "start.human.task"). This is serving default HTS functionality for my PoC application, where I'm connecting to HTS with this code:

                   

                  MinaTaskClientHandler handler = new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener());client = new TaskClient(new MinaTaskClientConnector(communityId.toString(), handler));client.connect("127.0.0.1", 9123);

                  You don't have to start ht server after starting demo installation, as from 5.3 demo installation has already deployed web application that exposes ht service over hornetq (messaging). So you should use HornetQ connector instead of mina and don't invoke ant start.human.task

                   

                   

                  If I got your answer right UserGroupCallback runs on HT service side, so I'm not sure if it suits my needs. My client is a Liferay portlet, which means it runs in external permission system, based on users and groups. The use case is I create and run processes (of human tasks) from this portlet, using Liferay user and group IDs. In portlet each user can check if there are any tasks for them (also basing on group membership). In Liferay user can belong to many groups and, of course, group membership can be (have to be) determined on portlet (Liferay) side in running server's context.

                   

                  This implies that UserGroupCallback implementation must be running on Liferay (client side...), which - as you said - is not the way to do it.

                   

                  Any suggestions on how to accomplish this task are welcomed. Maybe running HTS inside Liferay (Tomcat) is a solution here?

                  Does that mean that liferay manages all users and groups without any repository (like ldap, db, os, file....)? And how do you plan to use the engine itself? Are you going to embedded jbpm engine within liferay or use it like a service?

                   

                  Since ht server is embeddable same as engine there are many possibilities to make use of it. For instance if you would like to have it embedded in you liferay application you can still use it that way, when you look at the ht web application it is simple servlet that bootstraps the ht service and open transport support for it - starts hornetq server with some configuration like callback. So you could do pretty the same way and then callback will be capable of using internal liferay stuff and still work on server side. More over there is LocalTaskService that will work on the same level as process engine without any remote communication... so as said before there are number of options so you would need to provide bit more information about your case

                   

                  HTH

                  1 of 1 people found this helpful
                  • 6. Re: How to set UserGroupCallback for Human Task Service client
                    katis

                    Liferay persists users, groups, etc in DB, but it's accessible through DAO API, and it's Liferay engine that manages all the connections. So yes - permissions can be read from DB, but normally you don't do it that way - just interact with Liferay (local) services. Of course there are some possibilities to access them remotely, but they're complicated and it'd be better to apply one of the solutions you proposed.

                     

                    I've tried to set up LocalTaskService but run into many problems... as this forum is of much help, still lack of documentation or some tutorial makes start with HT somehow difficult - that's why I decided to use out of the box set up that came with jBPM 5.3 installer. Anyhow from what you suggested and from what I've learned so far - I'd like to integrate both jBPM engine and HT service into my app. I understand that HT would become LocalTaskService in such configuration, right?

                     

                    Can you point me to any resources on how to configure such architecture?

                     

                    Apart from that - many thanks for help so far

                    • 7. Re: How to set UserGroupCallback for Human Task Service client
                      a_nat

                      Thanks for answering Maciej.

                       

                      Yes there is an empty file named "jbpm.usergroup.callback.properties" inside jbpm-human-task-5.3.0.jar.

                      I can raise a JIRA if required for this.

                       

                      Also, how do I configure the HornetQ based human task service to listen to IP?

                       

                      • 8. Re: How to set UserGroupCallback for Human Task Service client
                        swiderski.maciej

                        Based on what you described here I believe that local task service would be good option for this case. What I could recommend to look at is ht tests cases of the code base. There are number of scenarios on how to set it up from both sides (ht handler and task service)

                         

                        local task used from ht handler

                        local task server

                         

                        Please take a look at their super classes fro some details.

                         

                        And of course search this forum or post your questions we are more than happy to help!!!

                         

                        HTH

                        • 9. Re: How to set UserGroupCallback for Human Task Service client
                          swiderski.maciej

                          could you try to remove that file and see if that solves the problem with single configuration place for callback? if so, please rise a jira issue for that.

                           

                          Cheers

                          • 10. Re: How to set UserGroupCallback for Human Task Service client
                            quirozariel21

                            Example:

                             

                            in the file jboss/bin/standalone.conf

                             

                               JAVA_OPTS="$JAVA_OPTS -Djbpm.user.info.properties=/WEB-INF/classes/jbpm.user.info.properties"

                               JAVA_OPTS="$JAVA_OPTS -Djbpm.usergroup.callback.properties=/WEB-INF/classes/jbpm.usergroup.callback.properties"

                             

                            the log show:

                            17:19:09,922 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jbpm-human-task-war]] (MSC service thread 1-7) StandardWrapper.Throwable: java.lang.RuntimeException: Error while creating instance of configurable class, class name: org.jbpm.task.identity.LDAPUserGroupCallbackImpl

                              at org.jbpm.task.servlet.HumanTaskServiceServlet.getInstance(HumanTaskServiceServlet.java:263) [classes:]

                              at org.jbpm.task.servlet.HumanTaskServiceServlet.init(HumanTaskServiceServlet.java:210) [classes:]

                              at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                              at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]

                              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0]

                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0]

                              at java.lang.Thread.run(Thread.java:780) [vm.jar:1.7.0]

                            Caused by: java.lang.IllegalArgumentException: No configuration found for LDAPUserGroupCallbackImpl, aborting...

                              at org.jbpm.task.identity.LDAPUserGroupCallbackImpl.validate(LDAPUserGroupCallbackImpl.java:330) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

                              at org.jbpm.task.identity.LDAPUserGroupCallbackImpl.<init>(LDAPUserGroupCallbackImpl.java:109) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

                              at java.lang.J9VMInternals.newInstanceImpl(Native Method) [vm.jar:1.7.0]

                              at java.lang.Class.newInstance(Class.java:1600) [vm.jar:1.7.0]

                              at org.jbpm.task.servlet.HumanTaskServiceServlet.getInstance(HumanTaskServiceServlet.java:259) [classes:]

                              ... 12 more

                             

                             

                            17:19:09,959 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jbpm-human-task-war]] (MSC service thread 1-7) Servlet /jbpm-human-task-war threw load() exception: java.lang.IllegalArgumentException: No configuration found for LDAPUserGroupCallbackImpl, aborting...

                              at org.jbpm.task.identity.LDAPUserGroupCallbackImpl.validate(LDAPUserGroupCallbackImpl.java:330) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

                              at org.jbpm.task.identity.LDAPUserGroupCallbackImpl.<init>(LDAPUserGroupCallbackImpl.java:109) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]

                              at java.lang.J9VMInternals.newInstanceImpl(Native Method) [vm.jar:1.7.0]

                              at java.lang.Class.newInstance(Class.java:1600) [vm.jar:1.7.0]

                              at org.jbpm.task.servlet.HumanTaskServiceServlet.getInstance(HumanTaskServiceServlet.java:259) [classes:]

                              at org.jbpm.task.servlet.HumanTaskServiceServlet.init(HumanTaskServiceServlet.java:210) [classes:]

                              at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                              at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]

                              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0]

                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0]

                              at java.lang.Thread.run(Thread.java:780) [vm.jar:1.7.0]

                             

                            how to set UserGroupCallback??