Create a batch file that calls a Pega 7 activity
Here's a situation that you might find useful when working with activities in Pega 7.
Scenario:
I want to call an activity from outside of Pega 7 by using a batch file (UNIX .sh or Windows .bat). It is currently possible to do so when using a browser, but I would like this to instead be an automated activity. If possible, I want to pass one argument of String so I can use it in the activity step.
Solution:
Wrap your activity in a service HTTP, and call the service HTTP from wget or curl. Don’t call activities directly, since doing so could result in unauthenticated or unsecure access.
From a system administration and operations perspective, be sure that your activity logs when it calls and what it did. To track agent starts and stops, create a custom log class and map it to an exposed table so you can write reports and have data easily accessible in a centralized location for all nodes. At a minimum, include oLog statements. For example:
HTTP service package URL's are .... http://<host>:<port>/prweb/PRHTTPService/<service package>/<service class>/<service method>?<parameter name=parameter value>&<parameter name=parameter value>
If you want to secure your service:
- In the service package, require authentication
- In wget parameters add --user and --password arguments for operators to run service under.
Note that running your activity directly from wget without a service wrapper might lead to issues that are tied to access group, ruleset and application, because the default PRPC:Unauthenticated access group would not have access to your rules. However, to troubleshoot this situation, you can use the full SnapStart syntax to authenticate and then launch the activity.