- 16 Nov 2022
- 5 Minutes to read
- Print
- DarkLight
- PDF
Hybrid scenario
- Updated on 16 Nov 2022
- 5 Minutes to read
- Print
- DarkLight
- PDF
Atomic Scope helps in getting an end to end visibility of integration solutions built using Azure Integration services such as Logic Apps, Azure Functions, APIM etc. In this article we will walk you through a sample Purchase Order processing scenario implimented using Logic App, Servicebus queue and BizTalk .
Scenario
Let us consider a Business Process called Kovai.AtomicScope.Hybrid. We will receive a transaction called HybridInbound. This transaction begins at a logic App called HybridInboundServiceBusLogicApp. This logic App does some validation and puts the message into a service bus queue. A BizTalk receive location makes use of servicebus adapter and polls the messages in the queue. The received message will be routed to a send port where the message will be sent to an ERP system. The scenario can be represented as below.
Pre-Requisites
To continue impimenting the scenario, please ensure you have followed the below steps.
1> Ensure you have installed Atomic Scope Core components
2> Ensure that you have installed Azure components
3> Ensure that you have activated Atomic Scope License
4> Ensure that you have deployed the Azure samples. Kovai.AtomicScope.Hybrid is also part of this. This means you do not have to create the Azure Logic Apps. It will all be available for you to start working with atomic scope.
5> Ensure that you have deployed BizTalk samples
6> Ensure that you have created a work space and added associated azure resource group
Updating receive location configuration
When the BizTalk samples are deployed, the receive location rcvLoc_HybridInbound_sbqueue will be configured with some dummy value in adapter configuration. We need to configure it with correct servicebus namespace, access key and queue name. The configuration is as below.
Provide the correct shared access key.
Business Process configuration
In his section we will walk you through creating business process, transaction, stages and tracking necessary data.
Note: You can directly import the configuration file if you do not want to recreate it from the beggining.
* Navigate to Business Process section in Atomic Scope portal
* Click Import , choose configuration file C:\Program Files (x86)\Kovai Ltd\AtomicScope\SDK\Samples\Configuration\Kovai.AtomicScope.Hybrid-Config.json
* Select Kovai.AtomicScope.Hybrid from the list nd click import.
Creating Business Process
- In Atomic Scope portal, navigate to Business Process section and click on Add Business Process button.
- Name the business process as Kovai.AtomicScope.Hybrid
Creating Business Transaction
Click on Add Transaction, name the transaction as HybridInbound.
Creating Stages
Follow the steps below to create a stage called ReceiveFromPartner which will be executed in HybridInboundServiceBusLogicApp
Click on the Add Stage button
Name the stage as ReceiveFromPartner
Similarly create stages named ReceiveFromLogicApp and SendToLob which will be executed in BizTalk receive and BizTalk Send ports.
Adding Global Properties
once we create the stages, we can start adding the tracked properties which will be collected during the runtime. The global properties are those which will be available in the grid.
In the ReceivedFromPartner stage, add a global property called SenderId as below.
Similarly add following other global properties.
Stage | Propertyname | PropertyType | PropertySource | Value |
---|---|---|---|---|
ReceivedFromPartner | ReceiverId | String | XPath | //ReceiverId/text() |
ReceivedFromPartner | MessageId | String | Xpath | //SenderId/text() |
Adding stage Properties
Similar to global properties we can add follwing stage properties. Stage properties are collected at each stage and available as tracked values.
Stage | Propertyname | PropertyType | PropertySource | Value |
---|---|---|---|---|
ReceiveFromLogicApp | InvoiceNumber | String | XPath | //InvNumber/text() |
Instrumenting in HybridInboundServiceBus LogicApp
The first stage in the transaction process is the ReceivedFromPartner. We will have to use AtomicScope connector to log the activities.
Note: The Atomic Samples which are installed , already have these connectors configured correctly. In this section we will talk about significance of the configuration.
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.
Start Activity Connector
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.
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.
Archive Activity Connector
We can archive the message by just enabling the flag in either Start activity or Update Activity connectors. However in some scenarios, it might be a necessity to log the message seperately.In such scenarios we can make use of Archive Activity Connector.
Log Exception connector
When an exception occurs during the execution of the logic app, we can make use of Log Exception activity connector.
Instrumenting in BizTalk Receive location
The receive location, receives the messages from the service bus queue. Since we consider receive location as one stage, we need to start and update the activity in the receive pipeline. The receive pipeline configuraiton is as below.
Note : It is recommended to archive the message at the begining of a receive pipeline.
When the BizTalk samples are deployed, the receive location configuration will be automatically available. we do not need to change any pipeline configuration.
Instrumenting in BizTalk Send Port
When the message is subscribed by a send port, the message will already have MainActivityId and PreviousStage informations.
Running the sample
Use the sample xml file C:\Program Files (x86)\Kovai Ltd\AtomicScope\SDK\Samples\TestLocations\POsample01.xml and post it to HybridInboundServiceBusLogicApp's url.
note: please use the application/xml as content-type
Tracking Flow
When the message is posted you will be able to see an activity in Atomic Scope portal as below.
Summary
In this article we learned using Atomic Scope in a hybrid integration flow which starts at logic app and ends at on-premises ERP.