Calling web services using queued execution
To preserve business data integrity across multiple Pega 7 Platform instances, messages can be sent asynchronously from one system to another. If the receiving system is unable to receive the message, the message can be queued until it can be resent later.
While a process is running, invoked web services cannot return a message. Instead, the SOAP Connector Invoke activity maps the outbound data to the list of Java objects that are saved as a parameter on the parameter page. The connect activity calls the RequestProcessor queueConnectRequest method instead of calling the SOAP service. 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 an agent to resend the message.
Suggested approach
To enable web services queuing, do the following tasks:
Select a queue
You can either use the default queue (System-Queue-ExecutionRequest-Connect-Default) or create a 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 .
- On the New Rule Instance tab, enter a short description in the Short Description field of the connect request processor.
- In the RuleSet field, enter the ruleset name that you want to save the connect request processor to. The ruleset name must be the same name as the Connect rule that you are using.
- In the Request processor field, enter the connect request processor name.
- On the Queuing Options tab, enter the queue class name in the Queue class name field to specify the queue that you want to store the queued messages in.
- On the Dequeuing Options tab, specify what actions cause items to be removed from the queue.
- Click to save the connect request processor.
Edit the connect rule
The connect rule needs to specify that the request must be queued instead of processed immediately. To edit the connect rule:
- Open the connect rule.
- On the Service tab, in the Processing options section, select the queuing (response will not be available) option from the Intended for field.
- In the Request processor field, enter the request processor that you created earlier.
Edit the connect activity
Set the connect activity to run the connect rule in queued mode. To edit the connect activity:
- Open the connect activity.
- Expand the step that runs the web service.
- In the form for the ExecutionMode field, select Queue.
- Because queuing a connection request is a database operation, include a Commit step in one of the following ways:
- After the web service invocation step in this activity
- In the parent activity that calls the connect activity
Test the web service
You can test the web service process to ensure that all the connections work correctly.
- Run the process that invokes the web service.
- View the instances of the queue class that you specified in the connect request processor. The Instances dialog box shows the instance and its status.
Instances dialog box
If you do not configure your connect request processor to keep items in the queue after successful completion, queue instances with a success status are not displayed.
Previous topic REST and SOAP integration services Next topic XSD type and element substitution for SOAP connectors