How to call Web services using queued execution (V5.5)
Summary
In order to preserve business data integrity across multiple Process Commander Systems, messages can be sent asynchronously from one system to another. In the case that the receiving system is unable to receive the message, the message can be queued and an attempt to resend can be made at a later time.
Web services invoked while a process is being run will not be able to return a message at that time. Instead, the SOAP Connector Invoke activity maps the outbound data into the list of Java objects that are saved as a parameter on the Parameter Page, and instead of calling the SOAP service calls the RequestProcessor queueConnectRequest method. This method creates a queue item instance in the PegaRules database, saves the Primary Page, Parameter Page and dequeuing options to it, and sets the status to “scheduled” for a scheduled execution by an Agent.
You will need to have a functioning connector in place to use this feature.
Suggested Approach
To enable web services queuing, you will need to:
- Select a Queue
- Create a Connect Request Processor
- Edit your Connect rule
- Edit your connect activity
Select a Queue
You can either use the default queue (System-Queue-ExecutionRequest-Connect-Default) or create a new queue by defining a new concrete class within the System-Queue-ExecutionRequest-Connect- class.
Create a Connect Request Processor
The Connect Request Processor defines the queue location and dequeuing options for the queued connection. To define a new Connect Request Processor:
- Click Application > New > Rule > Integration-Resources > Connect Request Processor. The New Rule Instance Dialog appears.
Enter the RuleSet Name you would like to save the Request Processor to. This should be the same RuleSet as the Connect rule you are using. Enter a name for the Request Processor. - On the Queuing Options tab, specify the queue you want to store the queued messages in. Specify the queue you defined above.
- On the Dequeuing Options tab, specify what actions will cause items to be removed from the queue. Save the Request Processor.
Edit the Connect Rule
The connect rule needs to specify that the request must be queued, as opposed to processed immediately. To edit the connect rule:
- Open the connect rule you wish to edit.
- On the Service tab, in the Processing Options section, select the queuing (response will not be available) option from the Intended for field and specify the Request Processor you created earlier.
Edit the Connect Activity
You need to set the connect activity to execute the connect rule in queued mode. To edit the connect activity:
- Open the connect activity.
- On the step that invokes the web service, set the Execution Mode to Queue.
- Because queuing connection request is a database operation, you should include a Commit step either:
- After the Connect-SOAP step in this activity
- In the parent activity that calls the Connect activity
Note: Ensurethat the ProcessConnectQueue activity in at least one Agent-Schedule instance for the Pega-IntSvcs agent has been enabled.
To test the service:
- Run the process that invokes the Web service.
- View the instances of the queue class you specified in the Request Processor. You should see one instance.
Note: If you did not configure your Connect Request Processor to keep items in the queue after successful completion, you will not see anything in the queue.