Tuesday, January 3, 2012

XSLT In BizTalk Maps

XSLT is by default used by BizTalk maps (XSLT engine) to transform source schema to destination schema so there is nothing new (If you just open the .cs file of a map you can see it clearly there) Intention of this post is to highlight different usages of custom XSLT.

1) WHEN to use XSLT ?
I would prefer to use XSLT in following scenarios,
Whenever you have implement a complex logic in map. Like Grouping, Sorting or joining multiple input messages or carrying out operations with those multiple messages etc.

2) WHY XSLT and not Functoids ?
I totally understand that these things can be done using functoids as well. But as per my expereince if you open a map which uses a lot of functoids and try to analyse the .cs file of a map you will realise that,
i) There are a lot of simplifications can be done in that code like inline xslt functions can be used but instead functoids create .net functions for them.
ii) Also lot of unnecessary variables are created in XSLT which is by default generated by functoids.
iii) If you can write a good xslt you can write much more optimized.(Learning XSLT is pretty simple I would say.) Which in turn positively going to impact on your map execution performance.
iv) Debugging XSLT independantly is very easy infact the Map debugging feature introduced in BizTalk intern uses the same XSLT debug functionality (remember the XSLT debug window which is opened at time of debugging a Map). You can keep you xslt seperate (custom xslt) and test it with your sample input messages independantly.

3) What is Extension XML ? When to use it ?
When you need to call external assembly you will need the reference to extension xml. Link below will explain the details of extension xml.
http://msdn.microsoft.com/en-us/library/aa547368.aspx.

4) XSLT Grouping ,Sorting samples.
Some typical samples of xslt grouping,
e.g. Input message is






















This needs to be Grouped and Sorted we can use an XSLT as below,














and the Output will be















5) Different XSL Functions :-
Below link gives description of some of the XSLT 1.0 functions,
http://www.zvon.org/xxl/XSLTreference/Output/xpathFunctionIndex.html



Imp Note:- As of now Microsoft only supports XSL 1.0, XSL 2.0 is much more powerful and contains a lot of functions compared to 1.0. My Wishlist would include support for XSL 2.0 from Microsoft in future versions of XSLT engine.

Monday, January 2, 2012

Host Throttling Experience - The published message could not be routed because no subscribers were found

"The published message could not be routed because no subscribers were found".. This is the error that every BizTalk developer has seen sometime or the other and most common reason that is seen is either send port or orchestration is not enlisted etc.

I am sharing my experience where i have seen this happening under severe load. I am talking about load of thousands (more than 60K) users per second, Each user was instantiating a web service call(it was required functionality). Everything was working fine for small load but as the load was increased beyond limit (forgot the exact users at that time) we started getting this error.

Resolution:-
After in depth analysis we came to know it was a Host throttling issue. Because the subscribers could not subscribe the published messages (Delivery Throttling). We started to monitor the performance counters and observed that the alloted Memory to BizTalk process was getting consumed fully. We Increased the Process Memory usage to 75% in host throttling settings and the issue got fixed :).

Conclusion - When you see "The published message could not be routed because no subscribers were found" this error at high load one of things you should check is monitor the performance counter for process momory usage (obviously first step will be to check whether the subscribers are enlisted or not :).)

Throttling details have been very well explained by Tord at http://biztalkadmin.com/biztalk-self-throttling/
& on MSDN at
http://msdn.microsoft.com/en-us/library/aa559893.aspx

I hope this post might be helpful If anyone of you ever face this issue anytime.


- Have a Great Time
Shailesh Kawade