This article describes how to trigger notifications from MassTransit to an external web service. The sample code contains a simple demo implementation, combining the MassTransit Launch Process Action with a Python script, wherein a SOAP client makes a call to an external web service.
For information on how to trigger notifications from MassTransit 7 to an external web service, please refer to Launch Process Action and Web Service Integration page.
When integrating MassTransit into a workflow, it might be necessary to notify an external program or web service when certain MassTransit actions occur. For detailed information on the MassTransit Actions feature, see the MassTransit manual.
Actions may be configured to launch an external process on the action trigger. This can be a script or executable program. In this demo, it is a Python script that can run on either Mac or Windows. For full information on Launch Process actions, including the environment variables and command line arguments available, see the Launch Process Actions KB article.
Within the Python script, a SOAP client is created and establishes a connection to a web service. In the demo, a sample SOAP server is provided that will run within an MTWeb environment. This SOAP server contains a method that will write a text file with file information that is passed to it from the SOAP client.
So for example, if the MassTransit Action is "After Files Are Added," when a file is added To Send for a particular contact, the Python script is launched as a separate process from MassTransit. When the script is launched, the database IDs of all the files in the action are passed as a command line argument. The Python script looks up information in the MassTransit database based on the database file IDs, then makes a SOAP call to the provided sample SOAP server, passing along the file information it looked up in the database. When the SOAP server is called, it takes in the file information and writes it to a file. This demonstrates how to get information about a particular MassTransit action to an external service or program.
Detailed setup and execution instructions are in the archive's README.txt file.
- PDF/PPT Description: Web Service Integration Demo