locked
BizTalk- Count the number of files processed. RRS feed

  • Question

  • I want to send an email having the count of the total number of files processed successfully from the BizTalk application. The email should also contain the file names of the files causing an exception in the processing.

    How can I achieve this processing?

    Any suggestion would be  helpful.

    Thank you all.

    Friday, January 29, 2016 9:45 AM

Answers

  • Hi,

    Well! If you wish to do this only for a particular application BAM will be  too much effort to put in.

    I recommend, you to download this sql script. BizTalk: Message count per Application

    How it works: http://blogs.msdn.com/b/amantaras/archive/2014/10/09/number-of-messages-per-application-dtadb-data.aspx

    This is will capture the count of messages received, send and failed for a particular application.

    Listed operations:
    Receiving
    Sending
    Error (if the send or receive operation fail)

    Another script provided by Tord to get the Statistics from in and out events in BizTalk

    This Script will provide you with information of transactions in your BizTalk Environment.

    The scripts checks the InOutEvents table in the BizTalkDTADb database. It will group by date (DD) and Hour(HH)

    Alternatively, You can also make use of existing BizTalk performance counters to monitor the messages.

    PerformanceCounter msgsReceivedCounter = new 
        PerformanceCounter("BizTalk:Messaging", "Documents received", "ReceiveHost", "BizTalkServer");
    msgsReceivedCounter.ReadOnly = true;
    PerformanceCounter msgsSentCounter = new 
        PerformanceCounter("BizTalk:Messaging", "Documents processed", "SendHost", "BizTalkServer");
    msgsSentCounter.ReadOnly = true;
    
    lblSent.Text = string.Format("{0}",  msgsSentCounter.NextValue());
    lblReceived.Text = string.Format("{0}",  msgsReceivedCounter.NextValue());

    But this has its own limitations. Refer: Get Biztalk's message count through C# .NET


    Rachit Sikroria (Microsoft Azure MVP)

    • Proposed as answer by Rachit SikroriaModerator Tuesday, February 2, 2016 2:39 AM
    • Marked as answer by PS16 Friday, February 5, 2016 11:17 AM
    Friday, January 29, 2016 1:27 PM
    Moderator

All replies

  • Hi,

    Thank you for posting on MSDN forum.

    Please have a look into below thread and the suggestion of M.R.Ashwin Prabhu,

    https://social.msdn.microsoft.com/Forums/en-US/8b8e4047-8d6e-40dd-9f35-ab85924a68a1/biztalk-message-count?forum=biztalkgeneral

    This is the best way to achieve your scenario.


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Friday, January 29, 2016 9:56 AM
    Moderator
  • I would suggest you use BAM within your solution to track the files being processed. This will then be available in the portal and you can query/view the results across different times/time slices, aggregated over weeks/months/quarter, etc.

    To help you with BAM I'd refer you to Business Activity Monitoring in Depth for Developers at https://msdn.microsoft.com/en-us/library/dd320628%28v=bts.10%29.aspx

    Regards.

    Friday, January 29, 2016 10:32 AM
  • Hi,

    Well! If you wish to do this only for a particular application BAM will be  too much effort to put in.

    I recommend, you to download this sql script. BizTalk: Message count per Application

    How it works: http://blogs.msdn.com/b/amantaras/archive/2014/10/09/number-of-messages-per-application-dtadb-data.aspx

    This is will capture the count of messages received, send and failed for a particular application.

    Listed operations:
    Receiving
    Sending
    Error (if the send or receive operation fail)

    Another script provided by Tord to get the Statistics from in and out events in BizTalk

    This Script will provide you with information of transactions in your BizTalk Environment.

    The scripts checks the InOutEvents table in the BizTalkDTADb database. It will group by date (DD) and Hour(HH)

    Alternatively, You can also make use of existing BizTalk performance counters to monitor the messages.

    PerformanceCounter msgsReceivedCounter = new 
        PerformanceCounter("BizTalk:Messaging", "Documents received", "ReceiveHost", "BizTalkServer");
    msgsReceivedCounter.ReadOnly = true;
    PerformanceCounter msgsSentCounter = new 
        PerformanceCounter("BizTalk:Messaging", "Documents processed", "SendHost", "BizTalkServer");
    msgsSentCounter.ReadOnly = true;
    
    lblSent.Text = string.Format("{0}",  msgsSentCounter.NextValue());
    lblReceived.Text = string.Format("{0}",  msgsReceivedCounter.NextValue());

    But this has its own limitations. Refer: Get Biztalk's message count through C# .NET


    Rachit Sikroria (Microsoft Azure MVP)

    • Proposed as answer by Rachit SikroriaModerator Tuesday, February 2, 2016 2:39 AM
    • Marked as answer by PS16 Friday, February 5, 2016 11:17 AM
    Friday, January 29, 2016 1:27 PM
    Moderator
  • What exactly do you mean by processed?

    If you mean an Orchestration Completes or a Message is successfully Sent, you can easily query the Tracking Database for this information.  Don't worry about 'performance' as you'd have to log this data anyway.

    You can find many sample Tracking queries with Bing: https://www.bing.com/search?q=biztalk+tracking+queries&pc=MOZI&form=MOZLBR

    Then use BizTalk Polling as described here: http://social.technet.microsoft.com/wiki/contents/articles/24803.biztalk-server-sql-patterns-for-polling-and-batch-retreive.aspx

    Or, use a SQL Agent job.


    Friday, January 29, 2016 2:01 PM
    Moderator
  • Thank you everyone for your helpful suggestions.

    I have used a manual code to calculate the number of files processed successfully to target folder location through an application and then sent the count through an email.

    here is the code we can use in a class file:

    *********CODE**********

    public int iCount = 0;

    System.IO.DirectoryInfo sourceFileDir = new System.IO.DirectoryInfo(<target folder location>);
                foreach (System.IO.FileInfo sourceFile in sourceFileDir.GetFiles("<type of the file; ex: *.xml>"))
                {
                    iCount++;
                }

    Friday, February 5, 2016 11:24 AM
  • Well, ok, but that won't give you what you asked for.  It's also not a good pattern.

    A database, DTA or BAM, solution is the only way to provide reliable and accurate reporting on you app.

    Friday, February 5, 2016 11:56 AM
    Moderator