locked
BizTalk Server 2013 R2 - How to configure Schedule Adapters to run from 10th to end of month RRS feed

  • Question

  • I am using BizTalk 2013 schedule adapter.  Is there a way to configure schedule adapter to run from 10th to end of month?

    Thank you.

    Thursday, October 12, 2017 9:37 PM

Answers

  • Thanks for your reply.

    I created a console application which will enable/disable a receive location based on days I want the port to run.  I than created a windows scheduler and configured this exe there.  it's working:)

    Here is a sample code in case if some one run into similar situation.

    using System.Collections;
    using Microsoft.BizTalk.ExplorerOM;
    namespace ScheduleTask
    {
        class Program
        {
            static void Main(string[] args)
            {
                StartReceiveLocation(args[0]);
            }
            static void StartReceiveLocation(string bizTalkServer)
            {
                string receivePortName = "ReceivePort";
                string receiveLocationName = "ReceiveLocation";
                BtsCatalogExplorer root = new BtsCatalogExplorer();
                root.ConnectionString = System.String.Format("Server={0};Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;",bizTalkServer);
                DateTime currentDate = DateTime.Now;
                int[] RunningDays = new int[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 };
                foreach (ReceivePort receivePort in root.ReceivePorts)
                {
                    {
                        if (receivePort.Name.Equals(receivePortName))
                        {
                            foreach (ReceiveLocation receiveLocation in receivePort.ReceiveLocations)
                            {
                                if (receiveLocation.Name.Equals(receiveLocationName))
                                {
                                    //Receive Location running window.  If Port is disabled than enabled it.
                                    if (CreditCardBatchRunningDays.Contains(currentDate.Day))
                                    {
                                        if (receiveLocation.Enable == false)
                                        {
                                            receiveLocation.Enable = true;
                                            root.SaveChanges();
                                        }
                                    }
                                    else
                                    {
                                        //Port must remain disabled.  
                                        if (receiveLocation.Enable == true)
                                        {
                                            receiveLocation.Enable = false;
                                            root.SaveChanges();
                                        }
                                    }
                                }
                            }
                        }}}}}}

    • Marked as answer by theman' Monday, October 16, 2017 8:48 PM
    Monday, October 16, 2017 8:47 PM

All replies

  • You could set up multiple receive locations, each set to a Schedule Type of Monthly setting the Day, so you would need 22 receive locations (10 through 31).  Which admittedly is rather clumsy and would need testing to see what it does when the month has less that 31 days.

    The other option would be to download the source code and alter it to cope with this scenario.

    The source code is still on Codeplex, which is going to be shutting down soon so hopefully one of the authors is going to move it to Github or other repository. 


    Thursday, October 12, 2017 11:11 PM
  • Thanks for your reply.

    I created a console application which will enable/disable a receive location based on days I want the port to run.  I than created a windows scheduler and configured this exe there.  it's working:)

    Here is a sample code in case if some one run into similar situation.

    using System.Collections;
    using Microsoft.BizTalk.ExplorerOM;
    namespace ScheduleTask
    {
        class Program
        {
            static void Main(string[] args)
            {
                StartReceiveLocation(args[0]);
            }
            static void StartReceiveLocation(string bizTalkServer)
            {
                string receivePortName = "ReceivePort";
                string receiveLocationName = "ReceiveLocation";
                BtsCatalogExplorer root = new BtsCatalogExplorer();
                root.ConnectionString = System.String.Format("Server={0};Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;",bizTalkServer);
                DateTime currentDate = DateTime.Now;
                int[] RunningDays = new int[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 };
                foreach (ReceivePort receivePort in root.ReceivePorts)
                {
                    {
                        if (receivePort.Name.Equals(receivePortName))
                        {
                            foreach (ReceiveLocation receiveLocation in receivePort.ReceiveLocations)
                            {
                                if (receiveLocation.Name.Equals(receiveLocationName))
                                {
                                    //Receive Location running window.  If Port is disabled than enabled it.
                                    if (CreditCardBatchRunningDays.Contains(currentDate.Day))
                                    {
                                        if (receiveLocation.Enable == false)
                                        {
                                            receiveLocation.Enable = true;
                                            root.SaveChanges();
                                        }
                                    }
                                    else
                                    {
                                        //Port must remain disabled.  
                                        if (receiveLocation.Enable == true)
                                        {
                                            receiveLocation.Enable = false;
                                            root.SaveChanges();
                                        }
                                    }
                                }
                            }
                        }}}}}}

    • Marked as answer by theman' Monday, October 16, 2017 8:48 PM
    Monday, October 16, 2017 8:47 PM