Wednesday, 10 March 2010

Biztalk HostInstance ThreshHold -Error nID int datatype

Can any one guess what would be maximum number of the messages can pass through the BizTalk Receive / Send Host?

I asked same question to many of my friends and every one given different answer like
Can pass “N” number of message
No Limit
Could be 10 lacks of instances

Which one is correct from your point of view? I know you are going to give me a new number. Any way let me try to answer this question also will explain you why should we consider this number?
Is this really a big impact for your application?

Well, I am working for Retail application and we normally receive a 200 – 1000 messages per sec. Also we need to send each message to 10 different locations. Hence the count on average is 500*10 = 5000 message instances will send through “SendHost”.

It has been working quite well and I never faced any issue with the BizTalk SendHot. On one Friday suddenly the SendHost got Stopped and I tried a lot to start the Host but no luck. It was throwing the below error.


Job Name :
MessageBox_Message_Cleanup_BizTalkMsgBoxDb
Error Description :
Arithmetic overflow error converting expression to data type int.
[SQLSTATE 22003] (Error 8115) The statement has been terminated. [SQLSTATE 01000] (Error 3621). The step failed.

This issue is due to threshold of Sendhost has crossed the Int value.
If I quickly check at the threshold of the SendHost I could find that it already reached Int value.

If you look at the Store procedures which has supported for the above job, It cleared said the data type used for nID as INT in stored procedure. But actually in table it declared as BigInt.

StoredProc Name: int_PurgeMessageZeroSumTable

CREATE PROCEDURE [dbo].[int_PurgeMessageZeroSumTable]
AS
declare @count int, @tmp int, @fUseTempTable bit,
@fContinue int,
@tnActiveTable tinyint,
@retVal int
create table #PurgeJobMsgIDs (nID int NOT NULL, uidMessageID uniqueidentifier NOT NULL)
create clustered index [CIX_PurgeJobMsgIDs] on [#PurgeJobMsgIDs] ([uidMessageID])
set @fContinue = 99
while (@fContinue >= 99)

This I have changed to BigINT as suggested by Microsoft.

Sunday, 21 February 2010

Sunday, 27 December 2009

Findout failure job list from your Server

Recenly I was searching for a query to findout the list of failed jobs from my Database server and send an email to my mail box.


Hope this could help you



Select top 100 * from msdb.dbo.sysjobhistory
where job_id IN (Select job_id from msdb.dbo.sysjobs_view Where enabled=1 )
and step_id=1 and run_date=convert(varchar, getdate(), 112)
and run_status=0
order by instance_id desc


Tuesday, 28 April 2009

Biztalk Testing tools


Unit and Functional Testing
Microsoft Visual Studio® Team Suite Testing Tools
Used for unit testing .NET code. For more information about the testing tools that are integrated into Visual Studio 2005 Team System see "Visual Studio 2005 Team System: Enabling Better Software Through Better Testing" at http://go.microsoft.com/fwlink/?LinkId=102208.

BizUnit
A framework designed for automated testing of BizTalk solutions.
Use of this tool is not supported by Microsoft, and Microsoft makes no guarantees about the suitability of this programs. Use of this program is entirely at your own risk.

NUnit
Used for unit testing .NET code.
Use of this tool is not supported by Microsoft, and Microsoft makes no guarantees about the suitability of this programs. Use of this program is entirely at your own risk.
For more information about NUnit, see http://go.microsoft.com/fwlink/?LinkID=47931

Performance Testing
Microsoft BizTalk LoadGen 2007 tool
Load generation tool used to run performance and stress tests against BizTalk Server.
For more information about the Microsoft BizTalk LoadGen 2007 tool, see http://go.microsoft.com/fwlink/?LinkId=59841.

Friday, 6 March 2009

How to remove NS0 from the Incoming or Outgoing Message of Biztalk

The concept is very simple , Just remove the TargetNamespace from your Incoming /Outgoing Message and maintain Unique Name for Root Element.

How to Remove TargetNamespace ?

Select your Schema level properties and Delete the TargetNamespace. It should be empty.

When you remove the Targetnamespace Message Type identifies your schema based on Root Name , meaning it would be a unique filed to identify the subscriber.

Complex Situations :

1) If two BizTalk Projects wants to keep similar XML Structure as incoming message , You have to change the Root Name.
2) If you want to use the schema as referenced Schemas which will not be useful.

If you look at a Message Type details in Database how BizTalk Stores internally, you can understand better. See the below image. The current scenario will store only the Root Element.

Message Type = TargetNameSpace#RootElement

Now you can Receive Incoming message as below format instead of with NS0
Same Rule apply for Outgoing message also.

but no guarantee that It performs correct action for all adapters. You need to experiment...

You can reach me @ raj.webjunky@yahoo.com





Monday, 23 February 2009

ParallelBranch- Scope Synchronized=True

ParallelBranch- Scope Synchronized=True – How to Skip execution of all branches ?
What is the purpose of using “Synchronized=Ture” at Scope Shape?
When ever you want to use a variable across the Parallel branches you need to set the property for each branch Scope Shape Synchronized=True. In other hand we can say , Sharing a variable across the branches.
Let say you declared a variable “vGlobalVariable” at Orchestration Level and you are trying to update/ Set the value in each/ one of the branch , then you may encounter the below error ( when Synchronized=False – its default property for Scope Shape)
Error :
'vGlobalVariable': if shared data is updated in a parallel then all references in every task must be in a synchronized or atomic scope.

To over come this error you need to set the Synchronized=True. Fine what is the next issue ?

When you set Synchronized=True then each branch will execute one after one, for example if you have 3 branches like Branch1, Branch2 and Branch3. Then BizTalk executes the each branch in same order 1 , 2 and 3.

Now I have error at Branch 2 and I am catching the Error at Branch 2 Exception Block. But I do not want to proceed for Branch 3. How do I control the execution of all branches?

“ I came up with simple logic, It could be a silly but it works well, The logic is Declare a Bool type variable at Orchestration (vFlag=Tue) level and set the value at Each Branch Exception Block.
Also Second Branch and 3rd Branch should have Decide Shape to Check the Condition. “

You can also check the below article from “Scott Colestock” – for more Experiments on Parallel Branch.
http://www.traceofthought.net/PermaLink,guid,e2e45c5b-e8f3-4c05-9c60-d6e5e1ec29b3.aspx

The Orchestration looks like below

If you have any issues , reach me @ raj.webjunky@yahoo.com


Monday, 9 February 2009

Add Additional SOAP Header while Publish Orchestration as Webservice

Last couple of days I was busy with documnetation work in my office and one of my friend request me to provide an example for how to add an additional Soap Header while publishing the orchestration as webservice. I just tried to provide a URL from google search, unfortunately I could not find any right answer. Then I started my new journey to prepare my own example.

I was trying to publish my Orchestration as Webservice and tried to add additional SOAP header ( provided option while publish). I created a new Property Schema and changed the Target Namespace as
http://schemas.microsoft.com/BizTalk/2003/SOAPHeader

But when I try to select the Schema while publishing in the Tool , I couldn’t find the schema from the list. I was surprised and recollected myself what I was doing wrong?. And as per my observations I found that Document schemas are in the list to add as Additional soap Header but not Property schemas.

But how this document schema can be treaded as SOAP Header ?? any guess ..?
Lets do a deep drive to and see how we can add additional soap header for your Published Webservice.

First step is to create normal Document Schema and Change Root Node as “AuthenticateSoapHeader”. And add two Field elements under root node like UserName , Password.
Create a Property Schema and Rename the Property1 element as “AuthenticateSoapHeader” and set the property Schema Base = “MessageContextPropertyBase” also the Target NameSpace as http://schemas.microsoft.com/BizTalk/2003/SOAPHeader.


For more details of creating SOAP Header Schema , refer the below link (Steps to Create Soap Header Schema)
http://rajwebjunky.blogspot.com/2009/01/how-to-send-custom-soap-headers-from.html

Lets try to understand the purpose of creating Property Schema : When ever you add Document schema as Additional SOAP header at publish tool BizTalk Creates an Soap header class with the root node of your Document Schema. In my Example AuthenticateSoapHeader is the Root node of my Document Schema.

If you look at the MessageContext Property of your Orchestration Instance for Incoming Message , It shows clearly that AuthenticateSoapHeader is one of the value sent along with incoming message as part of Soap header.

Now next step is to get the SoapHeader XML data and assign the value to Document Schema.
Write the below code at MessageAssignment Shape

// get SoapHeader Information from Context
vData= IncomingInvoiceMsg(SoapHeaderExposeOrch.AuthenticateSoapHeader);
//Load SoapHeader xml data and assing to Document Schema
vXmlObj= new System.Xml.XmlDocument();
vXmlObj.LoadXml(vData);

//Assign SoapHeadr XML to Document Schema
SoapHeaderMsg=vXmlObj;



reach me if you have any issues :
raj.webjunky@yahoo.com