0

I have a use case where I would want 10 worker threads in my system. Out of this, 6 worker threads should poll to one Task List and 4 worker threads to another task list.

I configured my code in such way on Flow Framework.

One of my activities is registered to a different task List. All other activities to a default task list. I have 6 worker threads listening to the default task list and remaining four listening to the other task list.

However when i execute my workflow, I get the error:

Task List Name: CIMSProposalActivityValidationTList

Identity: 29547@ccs-master-1001.vdc.xyz.com

Details: ["java.lang.IllegalStateException",{"cause":null,"stackTrace":[{"methodName":"current","fileName":"AsyncContextBase.java","lineNumber":27,"className":"com.amazonaws.services.simpleworkflow.flow.core.AsyncContextBase","nativeMethod":false},{"methodName":"","fileName":"AsyncContextBase.java","lineNumber":49,"className":"com.amazonaws.services.simpleworkflow.flow.core.AsyncContextBase","nativeMethod":false},{"methodName":"","fileName":"TryCatchFinallyContext.java","lineNumber":46,"className":"com.amazonaws.services.simpleworkflow.flow.core.TryCatchFinallyContext","nativeMethod":false},{"methodName":"","fileName":"TryCatchFinally.java","lineNumber":233,"className":"com.amazonaws.services.simpleworkflow.flow.core.TryCatchFinally","nativeMethod":false},{"methodName":"","fileName":"TryCatch.java","lineNumber":22,"className":"com.amazonaws.services.simpleworkflow.flow.core.TryCatch","nativeMethod":false},{"methodName":"","fileName":"GrooveScheduleAspect.java","lineNumber":93,"className":"com.amazon.transportation.groove.aspectj.GrooveScheduleAspect$1","nativeMethod":false},{"methodName":"processGrooveSchedule","fileName":"GrooveScheduleAspect.java","lineNumber":93,"className":"com.amazon.transportation.groove.aspectj.GrooveScheduleAspect","nativeMethod":false},{"methodName":"validate","fileName":"ValidationActivitiesImpl.java","lineNumber":23,"className":"com.amazon.cimsworkflow.activities.impl.ValidationActivitiesImpl","nativeMethod":false},{"methodName":"invoke0","fileName":"NativeMethodAccessorImpl.java","lineNumber":-2,"className":"sun.reflect.NativeMethodAccessorImpl","nativeMethod":true},{"methodName":"invoke","fileName":"NativeMethodAccessorImpl.java","lineNumber":57,"className":"sun.reflect.NativeMethodAccessorImpl","nativeMethod":false},{"methodName":"invoke","fileName":"DelegatingMethodAccessorImpl.java","lineNumber":43,"className":"sun.reflect.DelegatingMethodAccessorImpl","nativeMethod":false},{"methodName":"invoke","fileName":"Method.java","lineNumber":606,"className":"java.lang.reflect.Method","nativeMethod":false},{"methodName":"execute","fileName":"POJOActivityImplementation.java","lineNumber":63,"className":"com.amazonaws.services.simpleworkflow.flow.pojo.POJOActivityImplementation","nativeMethod":false},{"methodName":"execute","fileName":"ActivityImplementationBase.java","lineNumber":46,"className":"com.amazonaws.services.simpleworkflow.flow.generic.ActivityImplementationBase","nativeMethod":false},{"methodName":"execute","fileName":"SynchronousActivityTaskPoller.java","lineNumber":196,"className":"com.amazonaws.services.simpleworkflow.flow.worker.SynchronousActivityTaskPoller","nativeMethod":false},{"methodName":"run","fileName":"ActivityTaskPoller.java","lineNumber":97,"className":"com.amazonaws.services.simpleworkflow.flow.worker.ActivityTaskPoller$1","nativeMethod":false},{"methodName":"runWorker","fileName":"ThreadPoolExecutor.java","lineNumber":1145,"className":"java.util.concurrent.ThreadPoolExecutor","nativeMethod":false},{"methodName":"run","fileName":"ThreadPoolExecutor.java","lineNumber":615,"className":"java.util.concurrent.ThreadPoolExecutor$Worker","nativeMethod":false},{"methodName":"run","fileName":"Thread.java","lineNumber":744,"className":"java.lang.Thread","nativeMethod":false}],"message":"Attempt to execute asynchronous code outside of AsyncScope.doAsync() method","localizedMessage":"Attempt to execute asynchronous code outside of AsyncScope.doAsync() method","suppressed":["[Ljava.lang.Throwable;",[]]}]

Reason:

  • Attempt to execute asynchronous code outside of AsyncScope.doAsync() method

My task list is the new one I created. The threads are also as expected. but I am getting this error. Any leads on how to solve this. Please reply

JavaBeigner
  • 608
  • 9
  • 28

2 Answers2

1

AWS Flow Framework activity implementation cannot contain any asynchronous code. All such code is allowed only in workflow implementation. From the stack trace it looks like your activity implementation does reference TryCatch class which can be used only for asynchronous error handling.

Maxim Fateev
  • 6,458
  • 3
  • 20
  • 35
  • 1
    Can you achieve asynchronous implementation in activities using manual completion? – vvondra Sep 08 '15 at 13:28
  • Yes, activities can be implemented asynchronously as completion request can come from any thread or even process. But the problem was that Pradeep was trying to use Flow Framework asynchronous TryCatch inside an activity implementation which is not supported out of the box. It is indeed possible to use Flow Framework to implement asynchronous programs outside of the workflow scope. Use com.amazonaws.services.simpleworkflow.flow.core.AsyncScope as a root scope and eventLoop. – Maxim Fateev Sep 08 '15 at 18:11
-1

Different activities cannot have same task list names. Each activity needs different task list name. If you want same activity to poll multiple task lists then run multiple instance of the same activity and make each instance poll different task list.

Rohit
  • 842
  • 6
  • 8