Expand my Community achievements bar.

Invoke process from string value

Avatar

Level 8
Level 8
Hi all,



I am trying to create a monitoring process that should monitor a mailbox. This monitoring process should look in the subject of the individual mails and by the subject determine which action to take (which underlying process) that should be invoked.



So if subject is "Process1" then the monitoring process ahould invoke "Process1".



EIther I see the possiblilty of dropping the form (attached to the email) into a predefined watched folder with the name "Process1" or calling the appropriate process by creating my own code for the EJB-endpoint (or SOAP?). However I don't knwo which solution is the easiest. I don't want to manually create 50 unique folders if using the EJB endpoint is simple.



Does anyone of you have an obvious solution (which I might have overlooked) or just some comments/pointers for which/where to go from here they would be highly appreciated.



Sincerely

Kim
4 Replies

Avatar

Level 10
Why can't you just call the Process1 as sub process from the Monitoring process?



This way you don't have to create a bunch of watch folders. You can just pass the PDF as an input parameter for that sub process.



Jasmin

Avatar

Level 8
Level 8
Hi again,



Thanks for your suggestion.



The problem with doing it this way is that everytime we need a new process we will need to change the monitoring process.



The idea is that this process should never be changed (I know the number of processes that needs beforehand).



I hope you understand what I am trying to do, otherwise don't hesitate to ask, and I'll elaborate.



Sincerely

Kim

Avatar

Level 10
I get it now.



I would suggest to use the EJB to invoke LiveCycle. Like you mentioned, you should be able to create a generic function that takes the name of the process as an input parameter and then you call that process using a generic call (if the input/output parameters are the same).



This is an example:

public InvocationResponse InvokeShortLived(String service, String operation, Map parameters){

try {

// Create a ServiceClient object

ServiceClient myServiceClient = _factory.getServiceClient();



InvocationRequest request = _factory.createInvocationRequest(

service, // Specify the short-lived process name

operation, // Specify the operation name

null, // Specify input values

false); // Create a synchronous request



// Send the Invocation request to the short-lived process and

// get back an InvocationResponse object



InvocationResponse response = myServiceClient.invoke(request);

response.getOutputParameter("result");

eturn response;

} catch (Exception ex) {

System.out.println(" ERROR -> " + ex.getMessage());

ex.printStackTrace();

return null;

}

}



Jasmin

Avatar

Former Community Member
You might also be able to use events...the monitoring process throws an asynchronous event that contains the process name as event data. All other processes are listening for the event throw using event start points, and they filter on the process name.



If the event passes the filter, the process is invoked.



This is similar to subprocesses, but the event framework provides more flexibility.



See the Event Implementation section of http://livedocs.adobe.com/livecycle/es/wb_help/00000565.html



scott