2 Replies Latest reply on Dec 22, 2012 3:56 PM by garethed

    Getting task summaries

    garethed

      Hello,

       

      I'm writing a Rest API to manage user tasks.

      The code below is some test code to return a list of task summaries based on a user.

      This works the first time and the correct tasks are returned.

      If I then claim a task for exapmple, It will still show up in the list if the code below is called.

      If I restart JBoss inbetween then the list is correct.

       

      jBoss is running on a server on the LAN and Tomcat is running the REST API locally.

       

      It's like the data returned is being cached.

       

      Any help would be appriciated.

       

      Thanks.

       

      public TaskSummaryJson getPotentialTasks(String user, String locale){

       

                          TaskClient client = new TaskClient(new HornetQTaskClientConnector("client 1", new HornetQTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));

              client.connect("10.0.0.101", 5153);

             

             

              BlockingTaskSummaryResponseHandler taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();

             

              client.getTasksAssignedAsPotentialOwner(user, locale, taskSummaryResponseHandler);

             

        

              List<TaskSummary> tasks = taskSummaryResponseHandler.getResults();

             

              TaskSummaryJson summary  = new TaskSummaryJson();

              summary.setListObjects(tasks);

              summary.setSuccess(true);

              summary.setMessage("ok");

             

       

              try {

                                    client.disconnect();

                          } catch (Exception e) {

        // TODO Auto-generated catch block

                                    e.printStackTrace();

                          }

                          return summary;

                }

        • 1. Re: Getting task summaries
          thomas.setiabudi

          Hi Gareth Edwards,

           

          Try to use different client name everytime you create a task client.

           

          In your code there, you always use "client 1" as the task client name. Maybe you can add a random value, maybe something like this

           

          TaskClient client = new TaskClient(new HornetQTaskClientConnector("client 1" + String.valueOf(java.lang.Math.random()) , new HornetQTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));

                  client.connect("10.0.0.101", 5153);

           

           

          Regards,

          Thomas Setiabudi

          • 2. Re: Getting task summaries
            garethed

            Thanks I will give that a try.

             

            Regards,

             

            Gareth.