1 2 3 Previous Next 38 Replies Latest reply on Aug 3, 2011 2:44 PM by daniele.ulrich Go to original post
      • 30. Re: In memory TaskClient without Mina or JMS
        frankee787

        Hi Daniele,

           Thanks a lot for your recommendations.

         

        Just to clarify. If a transaction can work (in JTA) inside a spring IOC container, can we safely assume it will work inside a JEE App Server? I would like things to be unit testable outside the appserver(probably my ignorance).

         

        Regarding persistance.xml, its a good point. I shall keep that as a note to-do.

         

        Now that you have tagged 5.0 and re-written the TaskService and TaskServiceSession, how would you be able to migrate your code base to 5.1 , 5.2 and further on? Am sure it is possible , but it sure starts to be a pain after sometime.

         

        Hence wouldnt it be better if jBPM5 tasks support JTA type transactions. Which brings me to the last point as to whether you can open up a JIRA with the knowledge you have gained. Lets try to put this into the codebase so more people can use this seamlessly.

         

         

        Please keep us up to date; I will try to get in contact with the responsible developers for this sub project if we really decide to use this library in our project. Currently we are discussing to write it completely from scratch because it has not so many features implemented or is this mature that we could not do the same in a couple of days. I think the whole architecture should be reconsidered, with a pure business core and several providers for the different contexts this service could be running in.

           

         

         

         

         

        Sure, I'll do that.

         

        Regards,

        Franklin

        • 31. Re: In memory TaskClient without Mina or JMS
          daniele.ulrich

          Hi Franklin

           

          Yes, it should work in any JTA managed environment. There is simply no other choice than to rely on JTA and XA if you want to keep multiple databases in sync within proper transaction boundaries. For unit tests you have to solve the usual tasks if you need managed environments in J2SE; but you already have a recipe with your spring solution...

           

          I only have read access to the GIT repository, so I did not tag the source. I started from the 5.0.0 tag and need to apply similar changes to the 5.1.0-Final. Yes, as long as the JPA integration is no official part of the library, you will be responsible yourself for porting the changes in every new release.

           

          It is a question of the target architecture of the human task library: it is purely designed as stand alone server without the need of transactional behaviour. If the developer team sticks to this design they will probably not see a need to change anything. Hence raising a bug in JIRA would led to the "works as designed" conclusion.

           

          I will discuss these issues in our daily meeting today; if we decide to use the service, I will be able to put some additional effort into a portable solution... I already have a couple of ideas... i.e. an EntityManagerFactory wrapper that is capable to deal with a JTA environment could eliminate the necessity to change the library itself...

           

          Regards

           

          Daniele

          • 32. Re: In memory TaskClient without Mina or JMS
            frankee787

            Hi Marie,

               When you do

             

            taskSession.addTask(task, contentData) 

            instead of

            client.addTask(task, content, responseHandler)

             

            How would you be able to pull out the taskId ? Previously it could be done with responseHandler.getTaskId().

             

            Now , how would be possible ?

             

            Could I just do task.getId? Anyways I shall try it out.

             

            Regards,

            Franklin

            • 33. Re: In memory TaskClient without Mina or JMS
              daniele.ulrich

              as you already give the task you want to add you should have the task id set in the object you used as parameter (

              task.getId()

              )...  sometimes it is just too easy...

              • 34. Re: In memory TaskClient without Mina or JMS
                frankee787

                Hi Daniele,

                   The task.getId() is an auto incremented column in the table. So it would be there only AFTER  I have done an add(em.persist(task)). Won't be there BEFORE.

                 

                Regards,
                Franklin

                • 35. Re: In memory TaskClient without Mina or JMS
                  daniele.ulrich

                  you should have it after the commit - provided you talk about the Task Entity... if you do not have it, we're running in troubles...

                   

                  @Entity

                  public class Task implements Externalizable {

                      /**

                       * WSHT uses a name for the unique identifier, for now we use a generated ID which is also the key, which can be

                       * mapped to the name or a unique name field added later.

                       */

                      @Id

                      @GeneratedValue(strategy = GenerationType.AUTO)

                      private long                 id;

                   

                   

                   

                  -> check what your database is doing for GenrationType.AUTO; normally the value should be set after a commit... 

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                  • 36. Re: In memory TaskClient without Mina or JMS
                    frankee787

                    Hi Daniele,

                       I was able to plugin in the Human Task API along with my main application. The only problem I was facing was that, task.getId()  was returning 0 always. Until I noticed that there was no transaction taking place(My mistake). However, now it is WORKING fine. After I do a taskSession.add(Task,null) , I just retrieve the task.getId() and the value is there thankfully!!

                     

                      I really wish this is part of the core API. What good is the Human Task API , if it runs stand alone but cannot address the Transactional demarcation necessities? Anyways, I shall try to start out a JIRA and post it up over here for some votes.

                     

                       By any chance is your team pursuing the adoption of the API  in the project? If NO can you please state your reasons for not incorporating the API?

                     

                    Fingers crossed.

                     

                    Regards,

                    Franklin

                    • 37. Re: In memory TaskClient without Mina or JMS
                      frankee787

                      Dear Daniele,

                        In the patched jar there is a class called DefaultEscalatedDeadlineHandler

                       

                      After the deadline.setEscalated(true); Should it include deadline.setEscalated(true);

                       

                      Some how the boolean value is not getting persisted in the table.

                       

                      I can see SELECT queries such as follows trying to get the Deadline and Potentials owners, but nothing with INSERTS/UPDATES

                       

                      Hibernate: select reassignme0_.Escalation_Reassignments_Id as Escalation2_1_, reassignme0_.id as id1_, reassignme0_.id as id10_0_ from Reassignment reassignme0_ where reassignme0_.Escalation_Reassignments_Id=?

                      Hibernate: select potentialo0_.task_id as task1_1_, potentialo0_.entity_id as entity2_1_, organizati1_.id as id6_0_, organizati1_.DTYPE as DTYPE6_0_ from Reassignment_potentialOwners potentialo0_ left outer join OrganizationalEntity organizati1_ on potentialo0_.entity_id=organizati1_.id where potentialo0_.task_id=?

                      Hibernate: select task0_.id as id11_3_, task0_.allowedToDelegate as allowedT2_11_3_, task0_.taskInitiator_id as taskIni23_11_3_, task0_.priority as priority11_3_, task0_.activationTime as activati4_11_3_, task0_.actualOwner_id as actualO24_11_3_, task0_.createdBy_id as createdBy25_11_3_, task0_.createdOn as createdOn11_3_, task0_.documentAccessType as document6_11_3_, task0_.documentContentId as document7_11_3_, task0_.documentType as document8_11_3_, task0_.expirationTime as expirati9_11_3_, task0_.faultAccessType as faultAc10_11_3_, task0_.faultContentId as faultCo11_11_3_, task0_.faultName as faultName11_3_, task0_.faultType as faultType11_3_, task0_.outputAccessType as outputA14_11_3_, task0_.outputContentId as outputC15_11_3_, task0_.outputType as outputType11_3_, task0_.parentId as parentId11_3_, task0_.previousStatus as previou18_11_3_, task0_.processInstanceId as process19_11_3_, task0_.skipable as skipable11_3_, task0_.status as status11_3_, task0_.workItemId as workItemId11_3_, user1_.id as id6_0_, user2_.id as id6_1_, user3_.id as id6_2_ from Task task0_ left outer join OrganizationalEntity user1_ on task0_.taskInitiator_id=user1_.id left outer join OrganizationalEntity user2_ on task0_.actualOwner_id=user2_.id left outer join OrganizationalEntity user3_ on task0_.createdBy_id=user3_.id where task0_.id=?

                      Hibernate: select deadline0_.id as id4_0_, deadline0_.deadline_date as deadline2_4_0_, deadline0_.escalated as escalated4_0_ from Deadline deadline0_ where deadline0_.id=?

                       

                      Either ways, even if I put em.persist(deadline) nothing happens.

                       

                      Any hints or ideas on this problem

                       

                      Regards,

                      Franklin


                      • 38. Re: In memory TaskClient without Mina or JMS
                        daniele.ulrich

                        Hi Franklin

                         

                         

                         

                         

                         

                        public

                        executeEscalatedDeadline(Task task,

                        Deadline deadline,

                        EntityManager em,

                        TaskService service) {

                         

                        if ( deadline == null || deadline.getEscalations() == null

                        ) {

                         

                        ;

                        }

                         

                         

                        If I check the references to getEscalations() or setEscalations().... you will not find any except in a test case... even for the Entity "Escalation" itself you won't find references where the object would be created...

                         

                        So it will be up to you to write an EscalationHandler of your own and to register it with this constructor:

                         

                         

                        public

                         

                        TaskService(EntityManagerFactory emf, SystemEventListener systemEventListener, EscalatedDeadlineHandler escalationHandler)

                         

                        By the way: we have decided not to use this service anymore. As I said before it is not mature enough, furthermore we have found heavy memory leaks and inefficiencies (if you're using the EventListeners) and the effort to write a similar functionality is very low. Furthermore you can have a better integration in an existing user management.

                         

                        Regards

                         

                        Daniele

                        1 2 3 Previous Next