Saturday, May 27, 2017

BizTalk Feature Pack1 - Exploring Azure Application Insights

Continuing from where I left - Installing BizTalk 2016 feature pack 1 , let's walk-through the process of utilizing the feature - Azure Application Insights.

Steps are simple and no coding is required.
1. Create an instance of Application Insight

  • Login to Azure portal and click on New and search for Application Insights
      

  • Select Application Insights and click on Create
  • Give name , choose Application Type as General (As of now BizTalk is not added in list),Select subscription,Resource group, Location as per your convenience and click on create. 


  • That's it, your Application Insight instance is ready to use




  •  In order to sync data to this instance we need its Instrumentation Key, copy it and use when enabling Analytics on BizTalk Group




2.Install BizTalk Feature Pack1 (If not done already)

After you install Feature Pack, you have to Enable group-level analytics and select Target Type as Application Insight (as of now only this option is available) and against the Connection parameters provide the Instrumentation key of the Application Insight instance to which you want to send the tracked data.




Note: By Default group-level tracking is enabled.


3. Create BizTalk application or use existing application whose telemetry data is to be pushed to Azure Application insights

I am using already existing application, and enabled the analytics on the artifacts(RecceivePort,SendPort and Orchestration)




4. Check the data on Azure Application insight

Run few test transactions,Login to Azure portal and click on the Instance of Application Insight. On left pane look for Usage and in middle pane for Custom event (Time range I have selected 7 days)




Note: Events pushed from BizTalk are categorized as custom event in AI.

If interested in getting more details of any event, then just double click and new blade opens with more details (below I selected event marked in yellow and in next blade bar representation of Real User Traffic - it is one of the filter)



You can filter the events based on other properties too, just click on filters and you will see list 

You would see that this matches to the context properties when tracked message are looked upon in Admin console.


Does tracking has any effect on data ?


So the question might arise, is Tracking on the artifacts have to be turned on? To verify this, I unchecked all the tracking on orchestration - only analytics was enabled and ran few test followed by verifying the data at AI. All the events (receive/send)happening are reflected in AI.



Another way to check the events is to Click on Search and look for custom events (Usage is deprecated)




So what is the data sent


It is the same data which is visible in Admin console when we enable Track Events. Below are the tracked events of  an orchestration(with Track Events enabled) viewed in group hub.





With data going to AI, there are lots of options to query the data and also various option around viewing the data.

 How will following matter:  

1. BizTalk group can be synced to only one Application Insight instance as  of now
2.  Live stream can't be used as of now

Monday, May 22, 2017

JSON Decoder : Unexpected character encountered while parsing value

After fixing an error with JSON decoder -Property not specified in JSON decoder, got one more error from JSON decoder-



 



From the error it is clear that the data in response from the api is not valid JSON, thus the decoder throws error.


Why it happened


I went through the tracked service instance and checked what exactly is received, and as can be seen in below snap - it was HTML and no JSON message. 




And as the returned message starts with <  , the decoder was not able to parse it as valid JSON message is like:

{
   "company": "Maruti",
   "name": "Swift",
   "price": 800000
}

Note: The RestApi has not implemented the required functionality, only instance of webapi is provisioned in Azure - thus the HTML is returned.

What to do 


Here, we can't do anything except get the functionality implemented in Rest Api and let it return valid message. This error can also be encountered in case you are using JSON decoder and you receive XML.

Sunday, May 21, 2017

Error xxxx not specified in JSON decoder properties

Am working on a POC where I have to invoke a Rest Api, collect the response and do futher processing on it. So to accept JSON data coming in response, I created a custom pipeline having JSON decoder at decode stage. After deploying the project and configuring it, dropped the test instance at receive location and watching for output in OUT folder(configured to archive API response).

As no output was generated - means some error was encountered, visited event log and found below error:









Why this happened


It was my bad, missed to set couple of properties which are required by JSON decoder to convert JSON message in corresponding XML message i.e. Root Node Name and Namespace.







Above error is in situation where you do not specify Root Node Name and Namespace both or if only Namespace is set.
Out of curiosity wanted to check what JSON decoder says if I set Root Node Name only and leave Namespace as Blank - It says, I want it to build XML message for you ;)


What to do


When using JSON decoder it is mandatory to provide this two properties.It is because the Key is converted into element and Value as element value.

e.g.,

JSON Message:

{
   "company": "Maruti",
   "name": "Swift",
   "price": 800000
}

Corresponding XML:

   <company>Maruti</company>
   <name>Swift</name>
   <price>800000</price>



But a valid XML has a Root Node, thus that needs to be provided explicitly to JSON decoder to attach the converted XML structure under Root Node