Connected Thoughts – Thiago Almeida

July 4, 2009

Microsoft MVP in BizTalk

Filed under: BizTalk — Thiago Almeida @ 11:37 am

A few days ago I received an overnight email from Microsoft presenting me with an MVP award in BizTalk. Needless to say I am very excited and happy about it! It is not often that this kind of news is blogged about by one of the best in the field before you do.

I’m really looking forward to working a bit closer with other MVPs, which include many experts whom I look up to, and the product team. I will strive to improve my commitment to the BizTalk and Connected Systems community.
Thank you to all the Microsoft employees, other fellow MVPs (so good to say that), and members of the community that made this happen, and to all that have congratulated me.

Regards,
Thiago Almeida

July 1, 2009

Visual studio crash when trying to add pipeline components to toolbox

Filed under: BizTalk — Thiago Almeida @ 10:51 am

I ran into a very strange issue today. After installing the ESB Toolkit, I tried to ‘Choose Items…” in the pipeline components toolbox:

image

But every time I did that Visual Studio 2008 just closed without warning and the following exception appeared in the Application event log:

“ .NET Runtime version 2.0.50727.3074 – Fatal Execution Engine Error (72615FC0) (80131506)”

I then tried to choose items from the Toolbox with the the pipeline file and the entire solution closed and it then worked.  After that I was able to open the pipeline file and it worked fine, allowing me to add all the pipeline components that I wanted:

image

Go figure…

Regards,

Thiago Almeida

June 29, 2009

Using the BizTalk WCF-SQL Adapter to load a flat file into a SQL Server 2008 table

Filed under: BizTalk — Thiago Almeida @ 4:17 pm

While preparing for my webcast on the WCF-SQL Adapter as part of a series of webcasts* I ran into a requirement that is quite frequent with BizTalk solutions: merging the contents of a flat file with a SQL Server database table. I wrote a post a while ago on how call the same stored procedure multiple times without a loop shape with the ‘old’ BizTalk SQL adapter, and this post also covers that with the new WCF-SQL Adapter. The source code will be made available as soon as the webcasts are out, and I’ll update this to reflect that.

I have a flat file that contains a list of products. I need to load the contents of this flat file into a SQL Server 2008 table using BizTalk Server 2009 and the WCF-SQL Adapter. The table might already have some of the products in the flat file, and in this case the product row should be updated.

The data in my sample flat file was extracted from the Adventure Works sample database in the SQL Server 2008 samples in Codeplex, which gave me 504 products to play with.

 

Flat File and Debatching

As you might already know, messages with multiple items in them (multiple Products in this case) coming into BizTalk can be disassembled and debatched on their way in by the disassembler pipeline components. In this case, since it is a flat file that we are receiving, we will use the flat file disassembler component that comes out of the box with BizTalk.

In this post I want to go over loading the file into SQL Server in two ways: one by splitting the Product items into individual messages and loading them individually with the WCF-SQL Adapter; and another by not splitting the Product items and sending one single message to the WCF-SQL Adapter with all the products.

For that I created two flat file schemas, and both look like the below:

image

On one of the schemas the Product node has its ‘Max Occurs’ set to ‘unbounded’. The other schema has the Product node’s ‘Max Occurs’ set to 1.  This property is what tells the flat file disassembler pipeline component if it should debatch the Products or not.

I created two BizTalk pipelines to handle the two different schemas. I dragged the flat file disassembler pipeline component to the disassemble stage of each pipeline, and selected the appropriate schema for each.

image image image

 

SQL Server Table and Stored Procedure

On the SQL Server database side, we have a table called Product (what a surprise!) with the following columns:

image

We are going to call a stored procedure for each line in the flat file to load each product. An easy way to either insert the product if it doesn’t exist in the table or update it if it exists is to use the MERGE statement that is new in SQL Server 2008. So all we have in our stored procedure is the following:

CREATE PROCEDURE [dbo].[ADD_PRODUCT]

@ProductShortDescription varchar(50), @ProductFullDescription varchar(max), @UOM nchar(10), @UnitPrice money

AS BEGIN

SET NOCOUNT ON;

–Use merge statement to either insert or update product based on product short description

MERGE INTO Product AS Target

USING (SELECT @ProductShortDescription, @ProductFullDescription, @UOM, @UnitPrice)

AS Source(ProductShortDescription, ProductFullDescription, UOM, UnitPrice)

ON (Target.ProductShortDescription = Source.ProductShortDescription)

WHEN matched THEN

UPDATE SET ProductFullDescription = Source.ProductFullDescription, UOM = Source.UOM, UnitPrice = Source.UnitPrice

WHEN not matched THEN

INSERT (ProductShortDescription, ProductFullDescription, UOM, UnitPrice)

VALUES (Source.ProductShortDescription, Source.ProductFullDescription, Source.UOM, Source.UnitPrice);

END

WCF-SQL Adapter Schemas

To add the SQL Server schemas used by the WCF-SQL Adapter from the BizTalk solution you can right click on the BizTalk project, select Add, and then ‘Add Generated Items’. From there you can either choose the ‘Add Adapter Metadata’ or the ‘Consume Adapter Service’ options. They will both bring the ‘Consume Adapter Service’ wizard where you can connect to the target SQL Server database and select what items and operations you want to consume. In our case we are only interested on the ADD_PRODUCT strongly typed stored procedure:

image

This will give you a schema like the following for the ADD_PRODUCT stored procedure:

image

Note that the ADD_PRODUCT node is the root node, and therefore can only exist once in the XML instances for this schema. This is the schema we are going to map to for the debatched Product information we get from the flat file schema with a max occurs of 1.  It is a straight map then from the single product flat file schema to the single stored procedure schema:

image

That takes care of mapping the products when the flat file is being debatched into single product messages. Now what do we do about mapping all the products in the flat file to only one XML that is sent to the WCF-SQL Adapter? Here’s where the WCF-SQL Adapter’s composite operations come in handy. The composite operations in the adapter have been described on Richard Seroter’s book (free sample chapter on the WCF-SQL Adapter) and Brian Loesgen’s blog. I created a new schema with a root node ‘Request’ and a second root node ‘RequestResponse’. The first root node name isn’t really important, as long as the second root node name is the same as the first with a ‘Respose’ suffix. I then added the single ADD_PRODUCT schema as an XSD Import to my composite schema. This allows me to create an unbounded record under the ‘Request’ node and change it to have a data structure type of ns0:ADD_PRODUCT, and an unbounded record under the ‘RequestResponse’ node and change it to have a data structure type of ns0:ADD_PRODUCTResponse.

image

This allows us to map from the non debatched flat file schema to the schema created above:

image

 

Calling the WCF-SQL Adapter

After deploying the solution I created two receive ports and two respective receive locations – one of them configured with the debatching pipeline and the single product map, and the other configured with the single file pipeline and the composite operation map.

I then created two one way send ports with the WCF-Custom Adapter and the sqlBinding, each with a filter for one of the receive ports. The send port that filters on the debatched single product insert receive port is configured as follows, with the TypedProcedure/dbo/ADD_PRODUCT action:

image

The send port that filters on the single file with multiple products and composite operation map is configured as follows, with the CompositeOperation action:

image

Both  send ports had a binding type of sqlBinding of course, with the default values (make sure useAmbientTransaction is enabled so that the stored procedure calls are inside a transaction):

image

 

Transactions and Conclusion

So when we debatch the Products flat file on the way in we end up with multiple concurrent calls to the stored procedure via the WCF-SQL Adapter, each in its own transaction:

image

When we map the entire file to the composite schema we end up with one transaction that wraps around all the stored procedure calls:

image 

If we monitor the Transactions/sec for the database we see barely any activity when we use the single file method:

image

If we use the debatch multiple message method we some spikes as the multiple transaction to the database are made:

image

As expected the single file method performs much faster for loading the 504 rows into the table. By placing a datetime column on the products table I could see the difference from the first insert to the last is only 254 milliseconds. With the debatch method BizTalk goes through the debatched records at a much slower pace  taking around 16 seconds to load them all, since it has to map each debatched message, route multiple messages to the send port, create multiple transactions against SQL Server, etc.

After looking into it a bit more I also noticed that for the debatched scenario the message delivery throttling and message publishing throttling were kicking off for the BizTalk host loading the messages into SQL Server. By simply changing the number of samples that the host should base its throttling decision on to something over the 504 records being inserted the time for the debatched inserts went down to 4 seconds from the 16 seconds mentioned above:

image image

The debatch method is still useful in many situations – if you need to perform extra steps for each message in the batch, or if your DBAs require one transaction for each stored procedure call, etc.

As I mentioned at the beginning, the source code will be made available as soon as the BizTalk 2009 webcasts are out, and I’ll update this post to reflect that.

Regards,

Thiago Almeida

 

* BizTalk 2009 Light and Easy Webcast SeriesMick Badran asked many BizTalk/CSD MVPs and Industry experts (around the globe) to share their knowledge and expertise. We came up with a series of Webcasts/Presentations and Demo Code for the community around many aspects of BizTalk 2009 – from new features in BAM, SharePoint, SQL Adapter… to Orchestration Performance. Brilliant! Stay tuned as the bits are being finalized.

May 22, 2009

BizTalk Adapter Pack v2.0 Released

Filed under: BizTalk — Thiago Almeida @ 9:28 am

The final release of the BizTalk Adapter Pack version 2.0 is now available on MSDN and TechNet for subscribers. The single download contains both 32bit and 64bit versions.

Overview:

The Microsoft BizTalk Adapter Pack contains adapters that enable enterprise applications and databases to interface with each other by implementing a common adapter framework. They expose line of business applications and data as Windows Communication Foundation (WCF) services. Technically, the adapters are Windows Communication Framework (WCF) bindings, and they are built on top of the WCF Line Of Business Adapter SDK SP2.

Note that the adapters in the adapter pack do not require BizTalk Server – because they are bindings of WCF you can use them to expose the enterprise applications and databases by developing the solutions in Visual Studio 2005 or Visual Studio 2008 and hosting them on IIS or SharePoint or a custom WCF application.

TechEd USA had a presentation on the SAP adapters available in the Adapter Pack and how to use it with MOSS. Some more live meeting presentations introducing the adapters in the adapter pack are on their way so keep tuned!

If you want to start playing with the adapters now and don’t have a licence there’s a 120 day evaluation download available.

Adapters:

Version 2.0 of the adapter pack includes 5 adapters:

Microsoft BizTalk Adapter for SQL Server – Supports SQL Server 2000, SQL Server 2005 and SQL Server 2008. For BizTalk users this replaces the previous SQL Server adapter.  There is a separate download for this adapter that

Microsoft BizTalk Adapter 3.0 for Oracle Database - Oracle 9.2, Oracle 10.1, Oracle 10.2, Oracle 11.1

Microsoft BizTalk Adapter for Oracle E-Business Suite

Microsoft BizTalk Adapter 3.0 for mySAP Business Suite – SAP R/3 4.6c Non-Unicode, SAP R/3 4.7 Non-Unicode, SAP R/3 4.7 Unicode, SAP R/3 5.0 Non-Unicode, SAP R/3 5.0 Unicode, SAP R/3 6.0 Unicode

Microsoft BizTalk Adapter 3.0 for Siebel eBusiness Applications (32bit only) – Siebel 7.5 (7.5.3.15), Siebel 7.7 (7.7.2.8), Siebel 7.8 (7.8.2.6), Siebel 8.0 (8.0.0.1)

Licensing:

BizTalk Server 2009 Developer, Standard, Enterprise with or without software assurance – Included in the license

BizTalk Server 2009 Branch Edition – Not included in the licence

BizTalk Server 2006 R2 Developer, Standard, Enterprise with software assurance – Included in the license

BizTalk Server 2006 R2 Branch Edition – Not included in the licence

BizTalk Server 2006 R2 Developer, Standard, Enterprise without software assurance – Not included in the license

BizTalk Server 2006, 2004, 2002, 2000 :) – Does not work with these versions and of course not included in the license

For non BizTalk customers and BizTalk 2006 R2 customers without software assurance the current license price is US$5000 per processor socket. Please refer to the licensing page for an accurate price.

A separate download just for the SQL Adapter for BizTalk 2006 R2 and 2009 customers is available as well.

 

For more information refer to the adapters blog on MSDN.

–Thiago

May 15, 2009

Auckland Connected Systems User Group – Windows Communication Foundation Primer with Ulrich Roxburgh

Filed under: BizTalk — Thiago Almeida @ 5:36 pm

ACSUGLogoTitle

After a lull we are back on track with the Auckland Connected Systems User Group meetings. The next one is set for the 4th of June 2009 at Datacom in Auckland with the Windows Communication Foundation Primer presentation by Ulrich Roxburgh.

Please register if you are attending, and forward the meeting details below to those who might be interested:

Windows Communication Foundation Primer – Ulrich Roxburgh

In this session Ulrich introduces Windows Communication Foundation (WCF), delivered as part of the .NET 3.5 framework. Learn the basics of WCF and see how to create HTTP/XML based web services, and then learn about other binding and encoding options such as TCP/IP and Binary. Also learn how to create REST based services, and consume these using AJAX web pages.
Ulrich Roxburgh has worked for Microsoft Consulting Services for 9 ½ years, in various capacities ranging from Senior Consultant to Managing Consultant, in both New Zealand and Australia. He now works as the main consultant for Services2 Ltd. providing premium consultancy services in the areas of enterprise architecture, solution architecture and implementation services.

Drinks and pizza will be provided as always!

Location:
Datacom Systems Limited, 210 Federal Street, Auckland CBD, Auckland, 1141
Map (parking on the street outside Datacom)

Presentation starts: 4/06/2009 6:00:00 p.m. 

Register to attend

May 14, 2009

Sysprep a BizTalk 2009 VHD or renaming a BizTalk 2009 Dev Box

Filed under: BizTalk — Thiago Almeida @ 1:41 pm

Creating several BizTalk 2009 VHDs on Windows Server 2008 for your development team? Need to rename a BizTalk 2009 development machine? Well look no further than the admin samples that are part of the BizTalk 2009 SDK.

It contains the scripts you need to rename the machine in the registry, databases, etc, so that BizTalk will continue working after a sysprep’d VHD is started for the first time and the name is changed.

The path to it after you install the SDK on your BizTalk machine is <BizTalk installation path>\SDK\Samples\Admin\Sysprep

The online documentation is http://msdn.microsoft.com/en-us/library/dd792685.aspx

–Thiago

May 5, 2009

Book Review: SOA Patterns with BizTalk Server 2009 by Richard Seroter

Filed under: BizTalk — Thiago Almeida @ 7:22 pm

I have been contacted by Packt Publishing to post a blog review of Richard Seroter’s book ‘SOA Patterns with BizTalk Server 2009’. They have kindly provided me with the electronic copy while a printed copy I ordered a while ago makes its way to New Zealand.

The author Richard Seroter is a several times Microsoft MVP for BizTalk Server and a Microsoft Connected Systems Advisor. He has a very informative and active blog, presents frequently at user groups, and published a series of posts on TOPXML.com about WCF and BizTalk Server.

The book SOA Patterns with BizTalk Server 2009, as I have mentioned earlier, has been much anticipated by the BizTalk community. It covers some hot topics like implementing Service Oriented Architecture with BizTalk and the Enterprise Service Bus Guidance 2.0. But it goes far beyond this, providing much sought after guidance around WCF, BizTalk communication patterns, messaging, orchestrations, versioning, UDDI, and the new WCF based SQL adapter.

If you follow Richard’s blog you will be glad to know that the book is as absorbing and effortless to read, full of real life examples and code samples.

Chapter 1 gives an overview of BizTalk Server, how it has been used for Enterprise Application Integration (EAI), Business-to-Business (B2B) integration, Business Process Management (BPM), and how the foundations of these can be applied to Service Oriented Architecture. Richard in this chapter also covers the basic architecture of BizTalk, and the main artefacts that compose it.

Chapters 2 and 3 go over Windows Communication Foundation (WCF) and BizTalk Server and how they work together to provide powerful BizTalk backed WCF services, as well as consuming WCF services from BizTalk. It has many details around the WCF adapters that you will find nowhere else, like an overview of the WSDL of a WCF service and how it relates to values populated in the WCF Publishing Wizard.

Chapter 4 will appeal to those architecting BizTalk solutions, as it goes over the principles of service oriented architecture and how they apply to BizTalk Server. This is one of my favourite chapters in the book.

Chapters 5, 6, 7, and 8 will take you through a wild ride of hands on Service Oriented patterns and best practices implemented with BizTalk Server. Each chapter covers a different topic: Schemas and Endpoints, Asynchronous Communication, Orchestration, and Versioning.

Chapter 9 covers the new WCF SQL Adapter that is part of the BizTalk Adapter Pack 2.0. Richard covers several scenarios with the new adapter, including query notifications and using the adapter without BizTalk.

Chapter 10 is all about UDDI 3.0 that comes with BizTalk Server Server 2009, and how to use it to publish metadata about your services. This topic will get more coverage in the future given Microsoft’s drive to have BizTalk playing a big role in their SOA offerings and their move of UDDI from Windows Server to BizTalk.

Chapter 11 covers the much improved ESB Guidance 2.0. Richard gives a great overview of what’s offered in this version of the guidance pack, an goes over three scenarios of increasing complexity.

Chapter 12, the last chapter of the book, contains a quick insight into how BizTalk relates to Dublin, .NET Services and Oslo. I can see this topic becoming another book or at least a few blog posts after these technologies mature. I have no doubt they will be compared to BizTalk many times over in the coming years.

In summary this is a must have book for new and aspiring BizTalk and SOA solutions architects and developers alike. It should be referred back to at the beginning of any new BizTalk and SOA project.

The book can be purchased from Packt Publishing and Amazon. As a gift to those who have read this review, here is a PDF of Chapter 9: “WCF SQL Server Adapter”. Enjoy!

–Thiago

May 4, 2009

.NET and SQL Certifications presentation and BizTalk Server Exams

Filed under: BizTalk — Thiago Almeida @ 5:24 pm

I have recently attended to a presentation on .NET and SQL Server certifications hosted at Datacom by the Auckland SQL User Group

The presenter, James Hippolite, gave a great overview of the current .NET and SQL Server certifications available, and some insight into the experience of taking a Microsoft exam to those unfamiliar with the process. He also went through an amusing yet instructional history of the .NET exams and his experiences with them, and how the exams have evolved. You should check out his presentation slides for more information.

With regards to BizTalk Server there are currently three exams available that you can book and take through Prometric:

Exam 70-241: TS: Developing Business Process and Integration Solutions by Using Microsoft BizTalk Server 2006 R2 – Available October 17, 2008. Upon passing this exam you become  a Microsoft Certified Technology Specialist in BizTalk Server 2006 R2. http://www.microsoft.com/learning/en/us/exams/70-241.aspx

Exam 70-235: TS: Developing Business Process and Integration Solutions Using Microsoft BizTalk ServerAvailable July 18, 2006. Upon passing this exam you become a Microsoft Certified Technology Specialist in BizTalk Server 2006. http://www.microsoft.com/learning/en/us/exams/70-235.mspx

Exam 74-135: Developing E-Business Solutions Using Microsoft BizTalk Server 2004 – Available January 17, 2005. Upon passing this exam you become a Microsoft Certified Technology Specialist in BizTalk Server 2004. No other exam is required. http://www.microsoft.com/learning/en/us/exams/74-135.mspx

There used to be a BizTalk 2000 exam that has been retired for a long time, even though I know some brave individuals and fellow BizTalkers that have passed it as well as passing the the ones above.

One thing to note is that exams 70-504 Windows Workflow Foundation (WF) and 70-503 Windows Communication Foundation (WCF) by no means substitute the BizTalk specific exam. WF and WCF are foundations in the .NET framework upon which to develop applications. BizTalk Server is a complete integration and enterprise ready solution.

In the years ahead we will see features that have been available in BizTalk for a long time implemented in ‘Dublin’, an upcoming extension to Windows Server to host WCF and WF services. This will give companies the option of developing solutions for Dublin for scenarios where BizTalk would be overkill or does not apply. Maybe the two will share some core functionality in the future? A great article in the subject is Aaron Skonnard’s article on MSDN Magazine, ‘WCF And WF Services In The .NET Framework 4.0 And Dublin”. See the ‘What about BizTalk Server?’ note at the end.

–Thiago

April 30, 2009

MBVQueryBuilder and BizTalk Message Body Tracking Count queries

Filed under: BizTalk — Thiago Almeida @ 11:46 am

(link to new extension file at the bottom of the post)

Jean-Pierre Auconie (JP) , the creator of the Message Box Viewer tool for BizTalk, has released a supporting tool called the Message Box Viewer Query Builder. JP has also posted a quick help about the tool. On a previous post I went over how to extend the message box viewer tool version 10 with your own custom queries and provided a file for the five queries I created with message body tracking counts.

This new tool allows you to generate several kinds of custom queries to be run against a BizTalk environment when the MsgBoxViewer tool is run. You can:

  • Create SQL, general and BizTalk specific WMI queries
  • Run CMD, BAT, and VBS code
  • Run a custom method provided by a DLL you create

Since the release of the query builder the with the latest version of MsgBoxViewer the structure of the extension XML file generated has changed, so I’ve recreated my message tracking queries xml using the Query Builder tool (link at the bottom of the post).

Here are the steps I followed to create the new extension file:

First extract the zip file and then run MBVQueryBuilder.exe

Click the blue ‘Add’ button and the tool will ask you for the name of the XML file that will hold your queries. I called it ThiagoTrackingQueriesRepository.XML

Edit the Caption, Source, Comment, Category, Target Type, and Body properties to reflect my message body tracking queries (clicking the Add button for each new SQL Query):

image

Clicking the ‘Test Checked Queries’ will run MessageBoxViewer with only your queries for you to validate that the queries are running correctly and show you the HTML with the results for them at the end. Lastly, click the ‘Export to Query Extension File’ to generate my file.

Now, as per my previous post,  copy the created file to the same folder as the MessageBoxViewer executable. This will give you new tabs with the categories you entered in the query builder (mine is called ‘Message Body Tracking Counts’).

image

Upon running the collection you will get the queries in their own category results in the resulting XML:

image

 

You can run the Message Box Viewer tool periodically, or even have it automatically send emails with the results, to ensure your BizTalk system is following all the best practices checked by the tool and your custom queries built with the Query Builder.

You can download the new extension file with the message body tracking queries below:

MVBEXT.XML

April 28, 2009

BizTalk Server 2009 Officially Released and Installation Guides Updated

Filed under: BizTalk — Thiago Almeida @ 1:42 pm

 

Microsoft have now officially released BizTalk Server 2009 for general availability – the April 27, 2009 press release is available here.

To match the release there have been a few updates on the product page as mentioned by Richard Seroter. A couple of  other important changes I’ve noticed are:

BizTalk Server 2009 RTM Installation and Upgrade Guides – includes the installation guides to Windows Vista, XP, server 2003, server 2008, upgrade from BizTalk 2006 to 2009, RFID installations, and a troubleshooting guide.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=9c697e02-d1bc-4684-8748-28b3a292d5bf

BizTalk Server 2009 RTM Online Help – The full BizTalk Server 2009 help is now online

http://msdn.microsoft.com/en-us/library/bb430723.aspx

 

–Thiago

Older Posts »

Blog at WordPress.com.