joined BizTalkAdminsBlogging.com

My personal blog only exists for a year and a half now, but already has quite some visitors. Yesterday I was even asked to join another Biztalk blogging team on Biztalk administrator related topics. I already knew the blog and was a frequent visitor of the website. Of course I was glad to join the Biztalk blog team.

So, as of  today I joined several other biztalk experts on the BizTalk admin blog BizTalkAdminsBlogging.com.
This blog is dedicated to provide BizTalk admins with useful information, tips, example scripts and everything else that is interesting for a BizTalk admin.

I will still publish posts to this blog, but I will also write an occasional blog post for the BizTalkAdminsBlogging.com website… My first post on the site still has to be written, and any suggestions are always welcome :).

My profile on BizTalkAdminsblogging.com: http://www.biztalkadminsblogging.com/index.php/component/k2/itemlist/user/59-mitchvanhelden

BizTalk 2010: Creating TPM Partners through Code

Hi folks, recently I’ve been asked by several students on how to create Parties, Agreements, Profiles etc. via code in BizTalk 2010.

I played with this along time ago while at Redmond as BizTalk 2010 was in the process
of being released.

So I’ve just rolled up my sleeves and provided a quick demo for you – the demo shows:

  1. How to enumerate and get at each of your TPM Partners.
  2. How to create Partners + Profiles within BizTalk 2010.

Note: I’ve only tried this on BizTalk 2010 (& needless to say I’m claiming
‘works on my machine’ :))

What we’re talking about in BizTalk
This section here….

Show me the code….

Well the magic is found in this DLL –

C:\Program Files (x86)\Microsoft BizTalk Server 2010\Developer Tools\Microsoft.BizTalk.B2B.PartnerManagement.dll


– create a VS.NET 2010 app (for this demo I created a console app)
– we make a reference to the above DLL (we also need to reference system.data.entity)
– set a connectionstring to our BizTalk Management DB, mine is BizTalkDB (as
I rolled all the BizTalk DBs into one – for dev)
– start enumerating.

C# Looks like this

static void Main(string[]
args) { //enumerate
all the TPM Profiles in BizTalk var builder = new SqlConnectionStringBuilder("DATA
SOURCE=localhost;Initial Catalog=BizTalkDB;" + "Integrated
Security=SSPI;MultipleActiveResultSets=True"); var tmpCtx = TpmContext.Create(builder);
Console.WriteLine("Connected
to BizTalk Global Parties"); var partners = tmpCtx.Partners;
Console.WriteLine("Number
of Parters:{0}", partners.Count()); Console.WriteLine("------------"); foreach (var
ptr in partners)
{ var profiles = ptr.GetBusinessProfiles();
Console.WriteLine("{0}
Business Profiles:{1}", ptr.Name, profiles.Count); foreach (var
profile in profiles)
{ Console.WriteLine("\tProfile:{0}",
profile.Name); } } tmpCtx.Dispose(); if (bCreateProfile)
{ createProfile("Breeze
Partner #"); } Console.WriteLine("Finished");
Console.ReadLine(); }

Point to Note: in the connection string I set ‘MARS=true’ just so we can enumerate
several collections at once through the one context. When updating or saving new,
partners and/or profiles I get errors and can’t save through a MARs enabled connection.
(love to hear if you have different luck)

Creating a Partner + Profile

//
need to do this through a single threaded connection - no MARS private static void createProfile(string partnerName)
{ partnerName += DateTime.Now.ToString("yyyyMMdd-hhmmss") + (new Random().Next(0,
65535)); Console.WriteLine("Writing
a new Profile for {0}", partnerName); var builder = new SqlConnectionStringBuilder("DATA
SOURCE=localhost;Initial Catalog=BizTalkDB;Integrated Security=SSPI"); var
tmpCtx = TpmContext.Create(builder);
var ptr = tmpCtx.CreatePartner(partnerName);
var pname = "Breeze
Profile-#" + DateTime.Now.ToString("yyyyMMdd-hhmmss") + (new Random().Next(0,
65535)); var bp = ptr.CreateBusinessProfile(pname);
bp.Description = "Created
from Code"; var pcol = new AS2ProtocolSettings("BreezeProtocolSettings");
bp.AddProtocolSettings(pcol); tmpCtx.SaveChanges(); tmpCtx.Dispose(); }

And
that’s pretty much all there is to it folks, have a play around with the APIs for
yourself – all undocumented of course.

Here’s the Console App Solution I use (built for very demo purposes)

TPM API
Demo.zip (32 KB)

Enjoy Mick!

Blog Post by: Mick Badran

Guideline to Solve Performance issues of Biztalk

Typically a performance problem can be narrowed down to one of the following components of a BizTalk Server environment:

%u00b7         A receive adapter or the system from which the adapter is receiving documents. For example, if documents are being received by the HTTP adapter at a suboptimal rate then the problem may be with the HTTP receive adapter or with the client that is posting to the HTTP adapter.
%u00b7         An orchestration service instance.
%u00b7         Performance of the SQL Server that hosts the BizTalk Server databases.
%u00b7         A send adapter or the system that the adapter is sending documents to. For example, if documents are being sent by the SQL adapter at a suboptimal rate then the problem may be with the SQL send adapter or with the computer running SQL Server that the SQL adapter is updating.

Use the following guidelines to help identify the components of the BizTalk Server environment that are performing poorly:

%u00b7         Capture any warnings or errors generated in the BizTalk Server or SQL Server Event Viewer.
%u00b7         Follow the steps in “Identifying Performance Bottlenecks” in BizTalk Server Help at http://go.microsoft.com/fwlink/?LinkId=154238 to help identify performance bottlenecks.

Once the poorly performing component has been identified, follow the appropriate guidelines to help resolve the issue:
Guidelines for resolving performance problems related to send and receive adapters

%u00b7         For information about troubleshooting problems with BizTalk Server adapters, see “Troubleshooting BizTalk Server Adapters” in BizTalk Server Help at http://go.microsoft.com/fwlink/?LinkId=154240. This section contains general troubleshooting information including information about how to set up logging for certain adapters, and information that can be used diagnose network problems, problems with MSDTC, problems with the registry, problems with the file system, and problems with IIS.
%u00b7         For information about troubleshooting problems with MSDTC, certificates, Enterprise Single Sign-On, and SQL Server, see the appropriate section of “Troubleshooting BizTalk Server Dependencies” in BizTalk Server Help at http://go.microsoft.com/fwlink/?LinkId=154242.

Guidelines for resolving performance problems related to orchestrations

%u00b7         For information about modifying the appropriate sections of the BTSNTSvc.exe.config file, see “Orchestration Engine Configuration” in BizTalk Server Help at http://go.microsoft.com/fwlink/?LinkId=154244.

Guidelines for resolving performance problems related to SQL Server

%u00b7         SQL Server Profiler can be used to capture Transact-SQL statements that are sent to SQL Server and the SQL Server result sets from these statements. Since BizTalk Server is tightly integrated with SQL Server, the analysis of a SQL Server Profile trace can be a useful tool for analyzing problems that may occur in BizTalk Server when reading from and writing to SQL Server databases. For information about how to use SQL Server Profiler, see “Using SQL Server Profiler” in SQL Server Books Online at http://go.microsoft.com/fwlink/?linkid=104423.
%u00b7         SQL Server Management Studio can be used to execute SQL statements directly against SQL Server databases. This functionality may be useful for querying the BizTalk Server databases or for updating the BizTalk Server databases in certain scenarios. For more information about using SQL Server Management Studio to execute SQL statements, see “Writing, Analyzing, and Editing Scripts with SQL Server Management Studio” in SQL Server Books Online at http://go.microsoft.com/fwlink/?linkid=104425.
%u00b7         For more information about resolving performance problem related to the BizTalk Server databases, see “Troubleshooting SQL Server” in BizTalk Server Help at http://go.microsoft.com/fwlink/?LinkId=154250.

Sweden Windows Azure Group Meeting – Migrating Applications to Windows Azure & Sharding And Scaling with RavenDB, with Shay Friedman & Oren Eini

Wednesday, May 23, 6:00 PM, Stockholm

Migrating Applications to Windows Azure – Shay Friedman

Windows Azure is the next big thing for server-side applications and one of its major use cases is hosting existing .NET applications. However, Window Azure is not your regular playground and some preparations are necessary. In this session, Shay Friedman will take you through different ways to make sure your application is ready to move to the cloud. In addition, Friedman will explain how you can estimate the cost of running your web application in the cloud.

Sharding And Scaling with RavenDB – Oren Eini

From the get go, RavenDB was designed with sharding in mind. But sharding was always a complex topic, and it scared people off. Following the same principles that guides us with the rest of RavenDB design, we have taken sharding to the next level, made it easier to work with, performant and self optimizing.

Come to this talk with Ayende Rahien to discover RavenDB sharding, discuss scaling scenarios and see how we can use RavenDB in a high traffic scenarios.

Shay Friedman

Shay Friedman is a Visual C#/IronRuby MVP and the author of IronRuby Unleashed. With more than 10 years of experience in the software industry, Friedman now works in CodeValue, a company he has co-founded, where he creates products for developers, consults and conducts courses around the world about web development and dynamic languages. You can visit his blog at http://IronShay.com.

Oren Eini (Ayende Rahien)

Oren Eini has over 15 years of experience in the development world with a strong focus on the Microsoft and .NET ecosystem and has been awarded the Microsoft’s Most Valuable Professional since 2007. An internationally known presenter, Oren has spoken at conferences such as DevTeach, JAOO, QCon, Oredev, NDC,…

Are you using schedules/service windows in Receive Locations/Send Ports

There are some challenges in using BizTalk administration console if you are taking advantage of schedule/service window capabilities in BizTalk receive locations and Send ports.

If you are one of those customers with lots of scheduled receive locations and send ports, then you need to take a look at this blog post "BizTalk Receive Locations/Send Ports with service window – BizTalk360 can make your life easy"

Please add BizTalk360 RSS feed http://feeds.feedburner.com/biztalk360 to your reader to get product updates.

Nandri!

Saravana Kumar

BizTalk Host setup for your First BizTalk Projects

Ive been speaking to a few people starting their organisations first BizTalk projects recently and talking about Host setup and what is a good intial setup and how it may change over time.

Normally you see companies go one of two ways to begin with:

1. They just have one BizTalk host with an instance on each server and use it for everything

2. They have many instances for everything and use way more than they need to.

Im a big believer that a little thought about this and how your company plans to use BizTalk over time can help ensure you dont end up messing around with your host setup constantly.

I was saying to the team that probably the best way to start is create the following hosts to begin with.

  • A host called GenericRecevice which would be a host that your in process receive adapters can use
  • A host called GenericApplication which is a host for all of your orchestrations
  • A host called GenericSend which is a host for all of your send ports
  • A host called Tracking which is used for nothing but tracking.

I recommended they left the BizTalkApplication host because it can be the default incase anyone doesnt follow the above rules but do not have any instances of this host on any servers so your team are forced to fix configuration mistakes and to follow your host rules.

When you setup your host instances this obviously varies where you put each host instance based on the topology of your BizTalk group but having already splitt out your artefacts like suggested abovemakes it easier to move your hosts around in a consistent manner.

At this point you not have a clear well understood host setup and some simple rules around when you would use each one, however the key thing is that there will often be potential exceptions to these rules and you should ensure that if you want to create a new host for one or more artefacts you are able to explain clearly the reason for this new host and not just have a new host because the developer used a different name like Ive seen happen before.

Lastly a thought on the isolated host. We often tend to just have the one BizTalk Server Isolated Host which comes out of the box and run different adapter typeson seperate app pools in IIS as an example. This will cover the majority of cases but of course again there will be occasions where you have a need to do something different which is fine so long as its clearly explained.

I would say that generally good reasons for new hosts out side of this patten will be:

  • Performance reasons
  • Security Isolation
  • Adapter specific scenarios

Just a final note that this is intended as some advice when you start your companies first BizTalk projects. If you set of with this configuration it should cover you nicelyfor most of your cases.

Windows Azure tables: partitioning guid row keys | Windows Azure tables: partionnement de clefs de type GUID

 

 

This post is about using a partition key while the rowkey is a GUID in Windows Azure Table Storage. You may read more on Windows Azure Tables partitioning in this MSDN article. Ce billet est %u00e0 propos de l’utilisation d’une clef de partition alors que la clef est un GUID lors de l’utilisation des tables non relationnelles de Windows Azure. On trouvera des informations compl%u00e9mentaires sur le partitionnement des tables Windows Azure dans cet article MSDN.
Here is some context on when this sample code comes from. Voici un peu de contexte sur l’origine de cet exemple de code.
I’m currently developing some sample code that works as a canvas application in Facebook. As this type of app runs in a iFrame, it restricts the use of cookies. Still, I wanted to keep some authentication token from page to page (the Facebook signed_request) without displaying it explicitly in the URL (it may also be sent to HTTP referer headers to external sites). So i decided to store the signed_request in a session. ASP.NET sessions can have their ID stored in the URL instead of cookies but ASP.NET pipelines does not provide the session yet while authenticating. So I created my own storage for the authentication and authorization session (Auth Session for short). I did it in Windows Azure tables so that it can easily scale out. Je d%u00e9veloppe actuellement un exemple d’application Facebook de type Canvas. Comme ces types d’applications s’ex%u00e9cutent dans une IFrame, les cookies sont difficilement utilisables. Cependant je devais tout de m%u00eame pouvoir garder un jeton d’authentification de page en page (le champ signed_request de Facebook) sans l’afficher explicitement dans l’URL (il pourrait entre autres %u00eatre envoy%u00e9 dans l’ent%u00eate referer HTTP vers des sites externes). J’ai donc choisi de stocker le signed_request dans la session. ASP.NET propose de stocker l’ID de session dans l’URL plut%u00f4t que dans des cookies mais l’ordre des %u00e9v%u00e9nements ASP.NET fait que lors de l’authentification la session n’est pas encore disponible. J’ai donc cr%u00e9%u00e9 mon propre stockage pour la session d’authentification et d’autorisation (en abr%u00e9g%u00e9: Auth Session). Je l’ai fait en m’appuyant sur les tables Windows Azure de fa%u00e7on %u00e0 b%u00e9n%u00e9ficier simplement de la mont%u00e9e en charge horizontale.
The functional key is a GUID (I don’t want user X to guess user Y’s authSessionKey). The key is passed from page to page as a query parameter (typically, app urls look like this: https://myhost/somepath?authSessionKey=3479D7A2-5D1A-41A8-B8FF-4F62EB1A07BB. La clef fonctionnelle est un GUID (je ne veux pas que l’utilisateur X puisse deviner la clef de session d’un utilisateur Y). Cette clef est pass%u00e9e de page en page sous la forme d’un param%u00e8tre de la requ%u00eate (typiquement les urls de l’app. ressemblent %u00e0 ceci: https://myhost/somepath?authSessionKey=3479D7A2-5D1A-41A8-B8FF-4F62EB1A07BB.
Still, in order to have this scaling horizontally I need to have a partition key. Here is the code I used: Il reste que pour pouvoir monter en charge horizontalement, il faut une clef de partition. Voici le code:

  

internal class AuthSessionDataSource
{
//...
        public const int nbPartitions = 15;
// ...

public static class AuthSessionState
{
//...
    private static string PartitionKeyForGuid(Guid guid)
    {
        int sumOfBytes = 0;
        foreach (var x in guid.ToByteArray())
        {
            sumOfBytes += x;
        }
        int partitionNumber = sumOfBytes % AuthSessionDataSource.nbPartitions;
        return partitionNumber.ToString();
    }
//...
The principle is to get the remainder of the sum of all bytes participating in the GUID divided by the number of partitions as the partition number. Le principe est de prendre comme num%u00e9ro de partition le reste de la division de la somme des octets qui consituent le GUID par le nombre de partitions.
In order to have a rough idea of what it provides, here is a small console application (code, then sample execution result). De fa%u00e7on %u00e0 avoir une id%u00e9e rapide de ce que cela donne, on peut mettre le code dans une application console et l’ex%u00e9cuter.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 36; i++)
            {
                Guid g = Guid.NewGuid();
                Console.WriteLine("{0}, {1}", g, PartitionKeyForGuid(g));
            }
            Console.ReadLine();


        }


        private static string PartitionKeyForGuid(Guid guid)
        {
            const int nbPartitions = 12;

            int sumOfBytes = 0;
            foreach (var x in guid.ToByteArray())
            {
                sumOfBytes += x;
            }
            int partitionNumber = sumOfBytes % nbPartitions;
            return partitionNumber.ToString();
        }

    }
}

 

The advantage is that the partition numbers should be distributed quite regularly and that you can get calculate the partition from the rowkey as long as the number of partitions doesn’t change. L’avantage est que les num%u00e9ros de partition devraient %u00eatre distribu%u00e9s assez r%u00e9guli%u00e8rement et que l’on peut calculer ce num%u00e9ro de partition %u00e0 partir de la clef (le GUID) tant que le nombre de partitions ne change pas.
Should I change and have more partitions as the number of users grow, I could store new users’ sessions to a new table where the number of partitions is higher while keeping already active users to the old table. Auth sessions don’t live very long so changing the number of partitions can be quite simple. Et si on devait changer le nombre de partitions parce que le nombre d’utilisateurs augmente? Dans mon cas, je peux stocker les session des nouveaux utilisateurs dans une nouvelle table avec un plus grand nombre de partitions tout en gardant les utilisateurs d%u00e9j%u00e0 actifs dans l’ancienne table. Les Auth Sessions n’ont de toutes fa%u00e7ons pas une dur%u00e9e de vie tr%u00e8s longue et changer le nombre de partitions devrait %u00eatre assez simple.

 

public const int nbDaysForOldSessions = 3;
//...
internal void RemoveOldValues()
{
    DateTime oldDate = DateTime.UtcNow.AddDays(-1 * nbDaysForOldSessions);

    for(int p=0; p<nbPartitions; p++)
    {
        string partitionKey = p.ToString();
        var query = (from c in context.AuthSessionStateTable
                     where c.PartitionKey == partitionKey
                     && c.Timestamp <= oldDate
                     select c)
                    .AsTableServiceQuery<AuthSessionStateEntity>();
        var result = query.Execute();
        int i = 0;
        foreach (var x in result)
        {
            i++;
            this.context.DeleteObject(x);
            if (i >= 100)
            {
                this.context.SaveChangesWithRetries();
                i = 0;
            }
        }
        this.context.SaveChangesWithRetries();
    }
}

 

Why not using the rowkey as a partition key? Well having several rows in the same partition allows batching which is also good for performance. For instance, I have to remove old sessions. As batch can only happen in a same partition and as no more than 100 rows can be batched together, here is the code to purge old Auth sessions: Pourquoi ne pas utiliser la clef (le GUID) en tant que clef de partition %u00e9galement? En fait, avoir plusieurs rang%u00e9es dans la m%u00eame partition permet de grouper des requ%u00eates ce qui am%u00e9liore aussi les performances. Par exemple, j’ai besoin de supprimer les vieilles sessions. Comme les regroupements ne peuvent se faire que dans la m%u00eame partition et que 100 enregistrements par 100 enregistrements voici le code de purge des vieilles sessions:
In my case, having this way of partitioning data, seems to be a good fit. Dans mon cas, partitionner les donn%u00e9es de cette fa%u00e7on semble assez adapt%u00e9.

 

Benjamin

Blog Post by: Benjamin GUINEBERTIERE

BizTalk Server 2010 Cookbook by Steef-Jan Wiggers

BizTalk Server 2010 Cookbook by Steef-Jan Wiggers

In my previous post  I promised that my next blog post would be a follow up on the CRM2011 integration example.

Covering a rewrite of the CRM Workflow Component such that it incorporates functionality which uses the Windows Azure Service Bus Relay Services to send over the CRM data to BizTalk.

Well something kind of, came in between.. But no worries, I am still working on putting it all down in a blogpost and I hope to publish it pretty soon.

But in the meantime, keep on reading,  relax, get your mouse or your finger-tips ready to click or swipe a-long as I shamelessly present another blog-post dedicated to another great BizTalk Server book which is a must read…

It has been almost 2 months, since Packt publishing released Steef-Jan Wiggers book “BizTalk Server 2010 Cookbook“.

I had the privilege to review this book together with fellow BizTalk-ers; Randal van Splunteren, Abdul Rafay and Sandro Pereira

Steef-Jan put in a lot of effort writing this book, and well this book deserves all the attention it can get! So that’s the reason  I’ve decided to shamelessly plug it.

Like I said, it has been almost 2 months since Packt released this book and I for once could write yet another elaborate review explaining that Steef-Jan’s book is:

unique in its kind, must have, must read, no-nonsense,easy to read, covering almost all aspects ranging from development, architecture, testing to deployment, targets not only developers, architects, administrators and people who don’t work with BizTalk each and every day etc..

however by doing so I would merely repeat what a lot of fellow BizTalk-ers have been blogging about, so without further a due I present a small collection of links  pointing to reviews of Steef-Jan Wiggers book “BizTalk Server 2010 Cookbook”

Reviews by (in no particular order)

Tord Glad Nordahl

Lex Hegt

Mikael Sand
Saravana Kumar
Howard S. Edidin

Sandro Pereira

Antonino Crudele

Stephen W. Thomas
Abdul Rafay

Sandro Pereira

Well what’s keeping you here? Click on one of the links to buy this great book.

Cheers and till next time

René

BizTalk Server 2010 Cookbook Give-A-Way

I have known Steef-Jan Wiggers for many years now. He is a fellow BizTalk Server MVP and one of the sharpest BizTalk guys I know. So of course I was excited when I found out he was working on a solo BizTalk book.

His book is a cookbook-style book named BizTalk Server 2010 Cookbook by Packt Publishing. I like this style of book because it contains smaller units of examples related to a specific area or to solve a specific problem.

This book covers areas like setup, patterns, error handling, AppFabric connect, administration, and testing.  They are all easy to follow and it contains great illustrated examples.

This book is available on Amazon (currently with an awesome Kindle price of under $26) and online at Packt.com.

Packt is currently running some great specials at the Packt Microsoft Carnival.

While combing through some blogs today, I found two recent blog posts related to the book I co-authored, Applied Architecture Patterns on the Microsoft Platform. One was by Buck Woody and the other by Mark Brimble. It is great to see great comments on our book almost 2 years after it was published. With Packt’s Microsoft Sale, now is a great time to pick up our book along with the BizTalk Cookbook.

Here is a little known fact – I did not write any of the BizTalk content for our book – I did all of the AppFabric, Service Bus, and SharePoint sections!  Um, you all probably already knew that from the poor grammar and I am sure some spelling errors.

Here is your chance to win a copy of Steef’s new book. As runner-up prizes, I have copies of Dan Rosanova’s BizTalk 2010 Patterns and Pro BAM in BizTalk 2009. This will be a Facebook & Twitter only contest that will start next week.

http://www.facebook.com/BizTalkGurus http://twitter.com/BizTalkGurus

To get the details next week just like us on Facebook or Follow us on Twitter.