Restart flowable process from jms message listener

Hi All,

I Have a flowable workflow which I need to suspend at a certain stage, Then restart the same workflow from a JMS Listener based on a jms messag.

Here I have written a delegate to suspend the process and save the processId along with another ID called PkgId.

@Slf4j
@Component
public class ValidationDelegate extends AbstractBaseUtil {

    protected Expression restEndPoint;

    @Autowired
    private ProcessInstancePkgIdMapRepository repo;

    @Override
    public void executeInternal(DelegateExecution delegateExecution) {

        RuntimeService runtimeService = CommandContextUtil.getProcessEngineConfiguration().getRuntimeService();
        runtimeService.suspendProcessInstanceById(delegateExecution.getProcessInstanceId());

        ProcessInstancePkgMap pkgMap= new ProcessInstancePkgMap ();
        pkgMap.setPkgId(1235L);
        pkgMap.setProcessInstanceId(delegateExecution.getProcessInstanceId());

        ProcessInstancePkgMap map = repo.save(pkgMap);

        log.info("saved map {}", map);
    }
}

Then on a Separate class which has a method works as a JMS Listener, listens for a Tibco topic named “test.topic”. This method receives a message from tibco topic which contains PkgId. By Quering the repo with PkgId I’m able to find the relevant process instance id which was saved in the previously explained delegate. I’m trying to activate the suspended process afterwards from the process instance id

    @Component
    public class JMSListener {

        @Autowired
        private RuntimeService runtimeService;

        @Autowired
        private ProcessInstancePkgIdMapRepository repo;

        @JmsListener(destination = "test.topic", containerFactory = "jmsListenerContainerFactory")
        public void receiveMessage(TextMessage message) throws Exception {

            ObjectMapper objectMapper = new ObjectMapper();
            ValidationMessage validationMessage = objectMapper.readValue(message.getText(), ValidationMessage.class);

            ProcessInstancePkgIdMap idMap =
                    repo.findByPkgId(validationMessage.getPkgId());

            runtimeService.activateProcessInstanceById(idMap.getProcessInstanceId());

        }
    } 

But Getting an exception as,
org.flowable.common.engine.api.FlowableObjectNotFoundException: Cannot find processInstance for id ‘e84d407a-c043-11ea-b877-0a0027000002’.
when
runtimeService.activateProcessInstanceById(idMap.getProcessInstanceId());
is called from above method.

I checked all process instances via rest. But the result was empty. What Am I missing here? Does suspending the process makes it terminate? What is the approach to restart the suspended/paused workflow.