If you are familiar with Azure Logic Apps you must've used the designer view to create your own Orchestrations. To create it you will be using an Action. An action or otherwise known as connector, eg : Facebook, Outlook, Twitter etc.. To enable users to track data from their Business Logic into Serverless360 BAM we provide this connector
Getting the BAM Connectors in your Azure subscription
This repository will deploy the Serverless360 custom connector to your Azure Subscription.
Important points to note
- If you are deploying the connector to Subscription "Test", the connector will be available inside the Subscription "Test" only.
- If you have deployed the connector in Region "Central US", the logic Apps which needs the connector to be used should also be in the same region.
Authenticating BAM Connectors
Once you have created a Business Process in the Serverless360 portal, navigate to Settings -> Access Keys you can switch to the BAM Connector APIKEY tab and obtain the API KEY from there.
Copy that key and navigate to Azure portal and when you first add an action you will need to create and Authenticate the API connection using the API KEY.
You can enter a friendly name for the connection along with paste the copied key in the API key section.
Instrumenting in OrderValidation Logic App
The first stage in the transaction processing is OrderValidation. We will have to use Serverless360 BAM connectors to log the activitis.
Search and find the BAM connector from the Custom category as below.
The start activity and update activity connectors will be used at the begining and end of the validation logic inside the logic app as shown below.
We have predefined the Business Process and Transaction by declaring a variable, since it makes configuration easier.
The start activity connector initiates a stage and logs the time at which the stage is started. Hence the stage will be in the beginning of a logic . In the start activity connector, configure following properties. These properties are the same as the ones which were defined in business process configuration.
The start activity connector returns two fields in its response. MainActivityId and the StageActivityId. The MainActivityId is a correlation id for the complete transaction. It will be used for the stages further in the flow. StageActivityId is specific to stage and will be used in Update Activity Connector.
The update Activity connector is responsible for updating the status of the transaction. Apart from this it also collects all the configured Global and tracked proeprties based on stage configuration.
The MiainActivityId and StageActivityId will be the values returned from the StartActivity connector. Once the update activity is executed, it indicates the completion of the stage and the Status flag decides if it was successful or not. In this scenario the flow is successful.
Log Exception Activity
This connector creates an exception object correlating the stage using StageActivityId from the StartActivity connector and creates an event in the Event Hub with the object data. This connector can be invoked for any business or system exception that you would want to capture.
- StageActivityId - StageActivityId from the previous action output
- ExceptionMessage - Message that you want to log
- ExceptionCode -Some unique identifier or code that you want to associate with the exception type
To archive a message pass the message in the similar format to StartActivity with the below mandatory headers.
- SL360-BusinessProcess: Name of the Business Process
- SL360-StageActivityId - StageActivityId from the response of StartActivity.
- SL360-BusinessTransaction: Name of the Business Transaction
- SL360-CurrentStage: Current Stage under execution
You can also Archive the message within the Start / Update Activities setting the AS-ArchiveMessage to True in the headers for those activities.