BizTalk手动获取文件而不是轮询

BizTalk手动获取文件而不是轮询,biztalk,Biztalk,我想知道是否有一种方法可以将BizTalk配置为拥有一个编排,该编排不会不断轮询文件夹中的文件,而是“按需”检查文件 所谓“按需”,我的意思是我需要BizTalk“等待”web服务调用(通过WCF端口),然后在FTP文件夹中获取文件并启动编排 这是可行的吗?我读到“动态端口”可以用于此,是真的吗 谢谢, Alex不幸的是,BizTalk为此提供的唯一功能是服务窗口,它允许您计划打开和关闭接收位置 然而,这是非常严格的,每24小时只有一个窗口。你还必须事先知道时间 动态端口仅适用于消息的发送,不适

我想知道是否有一种方法可以将BizTalk配置为拥有一个编排,该编排不会不断轮询文件夹中的文件,而是“按需”检查文件

所谓“按需”,我的意思是我需要BizTalk“等待”web服务调用(通过WCF端口),然后在FTP文件夹中获取文件并启动编排

这是可行的吗?我读到“动态端口”可以用于此,是真的吗

谢谢,
Alex

不幸的是,BizTalk为此提供的唯一功能是服务窗口,它允许您计划打开和关闭接收位置

然而,这是非常严格的,每24小时只有一个窗口。你还必须事先知道时间


动态端口仅适用于消息的发送,不适用于消息的接收。

不幸的是,BizTalk为此提供的唯一功能是服务窗口,它允许您计划打开和关闭接收位置

然而,这是非常严格的,每24小时只有一个窗口。你还必须事先知道时间


动态端口仅应用于消息的发送,而不用于接收它们。

如果您以任何方式控制web服务,则始终可以使用队列或数据库表将两个系统松散耦合,即更改web服务,以便在进行调用时,将BizTalk的消息放置在队列/表中。然后将业务流程连接到同一队列/表,以便它“按需”获取文件。这种情况可能不完全适合您的情况,但这可能是您能得到的最接近的情况…

如果您以任何方式控制web服务,那么您总是可以使用队列或数据库表将两个系统松散耦合,即更改web服务,以便在进行调用时,BizTalk的消息放置在队列/表中。然后将业务流程连接到同一队列/表,以便它“按需”获取文件。此场景可能不完全适合您的情况,但这可能是您能获得的最接近的位置…

您可以在由WCF接收端口激活的业务流程中动态创建文件(或FTP)接收位置

Brian Loesgen是一个简单的代码示例,您的业务流程可以调用它来创建接收位置。如果服务器和文件夹名称在一次呼叫到下一次呼叫时没有更改,那么每次都可以使用相同的接收位置,只需在运行时激活/停用它即可

下面是另一个堆栈溢出问题,具体解决了在代码中激活接收位置的问题: 在Visual Studio中创建一个新的类项目,添加对Microsoft.BizTalk.Explorer的引用,编写几行代码,就有了帮助程序集

以下是创建和配置HTTP接收位置的示例:

private void CreateAndConfigureReceiveLocation()
{
   BtsCatalogExplorer root = new BtsCatalogExplorer();
   try
   {
      root.ConnectionString = "Server=.;Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;";

      //First, create a new one way receive port.
      ReceivePort myreceivePort = root.AddNewReceivePort(false);

      //Note that if you dont set the name property for the receieve port, 
      //it will create a new receive location and add it to the receive       //port.
      myreceivePort.Name = "My Receive Port";

      //Create a new receive location and add it to the receive port
      ReceiveLocation myreceiveLocation = myreceivePort.AddNewReceiveLocation();

      foreach(ReceiveHandler handler in root.ReceiveHandlers)
      {
         if(handler.TransportType.Name == "HTTP")
         {
            myreceiveLocation.ReceiveHandler = handler;
            break;
         }
      }

      //Associate a transport protocol and URI with the receive location.
      foreach (ProtocolType protocol in root.ProtocolTypes)
      {
         if(protocol.Name == "HTTP")
         {
            myreceiveLocation.TransportType =  protocol;
            break;
         }
      }

      myreceiveLocation.Address = "/home";
      //Assign the first receive pipeline found to process the message.
      foreach(Pipeline pipeline in root.Pipelines)
      {
         if(pipeline.Type == PipelineType.Receive)
         {
            myreceiveLocation.ReceivePipeline = pipeline;
            break;
         }
      }

      //Enable the receive location.
      myreceiveLocation.Enable = true;
      myreceiveLocation.FragmentMessages = Fragmentation.Yes;//optional property
      myreceiveLocation.ServiceWindowEnabled = false; //optional property

      //Try to commit the changes made so far. If the commit fails, 
      //roll-back all changes.
      root.SaveChanges();
   }
   catch(Exception e)
   {
      root.DiscardChanges();
      throw e;
   }
}

您可以在由WCF接收端口激活的业务流程中动态创建文件(或FTP)接收位置

Brian Loesgen是一个简单的代码示例,您的业务流程可以调用它来创建接收位置。如果服务器和文件夹名称在一次呼叫到下一次呼叫时没有更改,那么每次都可以使用相同的接收位置,只需在运行时激活/停用它即可

下面是另一个堆栈溢出问题,具体解决了在代码中激活接收位置的问题: 在Visual Studio中创建一个新的类项目,添加对Microsoft.BizTalk.Explorer的引用,编写几行代码,就有了帮助程序集

以下是创建和配置HTTP接收位置的示例:

private void CreateAndConfigureReceiveLocation()
{
   BtsCatalogExplorer root = new BtsCatalogExplorer();
   try
   {
      root.ConnectionString = "Server=.;Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;";

      //First, create a new one way receive port.
      ReceivePort myreceivePort = root.AddNewReceivePort(false);

      //Note that if you dont set the name property for the receieve port, 
      //it will create a new receive location and add it to the receive       //port.
      myreceivePort.Name = "My Receive Port";

      //Create a new receive location and add it to the receive port
      ReceiveLocation myreceiveLocation = myreceivePort.AddNewReceiveLocation();

      foreach(ReceiveHandler handler in root.ReceiveHandlers)
      {
         if(handler.TransportType.Name == "HTTP")
         {
            myreceiveLocation.ReceiveHandler = handler;
            break;
         }
      }

      //Associate a transport protocol and URI with the receive location.
      foreach (ProtocolType protocol in root.ProtocolTypes)
      {
         if(protocol.Name == "HTTP")
         {
            myreceiveLocation.TransportType =  protocol;
            break;
         }
      }

      myreceiveLocation.Address = "/home";
      //Assign the first receive pipeline found to process the message.
      foreach(Pipeline pipeline in root.Pipelines)
      {
         if(pipeline.Type == PipelineType.Receive)
         {
            myreceiveLocation.ReceivePipeline = pipeline;
            break;
         }
      }

      //Enable the receive location.
      myreceiveLocation.Enable = true;
      myreceiveLocation.FragmentMessages = Fragmentation.Yes;//optional property
      myreceiveLocation.ServiceWindowEnabled = false; //optional property

      //Try to commit the changes made so far. If the commit fails, 
      //roll-back all changes.
      root.SaveChanges();
   }
   catch(Exception e)
   {
      root.DiscardChanges();
      throw e;
   }
}