次の方法で共有


コードでのリゾルバー コンポーネントの使用

動的変換エージェントの次のコード フラグメントは、Just-In-Time (JIT) の既定の解決機能を示しています。 同様のコードを使用して、独自のアプリケーションで簡単に解決を実装できます。

  
//XLANGs  
itinerary = new Microsoft.Practices.ESB.Itinerary.SerializableItineraryWrapper();  
step = new Microsoft.Practices.ESB.Itinerary.SerializableItineraryStepWrapper();  
  
itinerary.Itinerary = Microsoft.Practices.ESB.Itinerary.ItineraryOMFactory.Create(InboundMessage);  
step.ItineraryStep = itinerary.Itinerary.GetItineraryStep(InboundMessage);  
resolvers = step.ItineraryStep.ResolverCollection;  
resolvers.MoveNext();  
resolver = resolvers.Current;  
  
// Pass the resolver configuration to the Resolver mgr for resolution.  
resolverDictionary = Microsoft.Practices.ESB.Resolver.ResolverMgr.Resolve(InboundMessage, resolver);  
  
// Set the transform type.  
transformType = resolverDictionary.Item("Resolver.TransformType");  

前の一覧では、ResolverMgr クラスの Resolve メソッドは、すべての既定の解決プロパティとその解決された値を含む Dictionary オブジェクトを返します。 カスタム リゾルバーは、 Dictionary オブジェクトにカスタム プロパティを追加できます。これにより、これらのプロパティを任意のカスタム スケジュール サービスで使用できるようになります。

次の表は、Microsoft BizTalk ESB Toolkit に含まれるリゾルバーによって必要に応じて設定できるプロパティを示しています。 スケジュール サービスは、返された Dictionary オブジェクトからこれらのプロパティ値を抽出することで取得できます。

[プロパティ] :

     
Resolver.Action Resolver.ActionField Resolver.DocumentSpecName
リゾルバー.成功 Resolver.EndpointConfig Resolver.DocumentSpecStrongName
Resolver.FixJaxRpc Resolver.InboundTransportType Resolver.EpmRRCorrelationToken
Resolver.InterchangeId Resolver.IsRequestResponse Resolver.InboundTransportLocation
Resolver.MessageType Resolver.MethodName Resolver.メッセージ交換パターン
Resolver.ReceivePortName Resolver.TransportLocation Resolver.OutboundTransportCLSID
Resolver.TransformType Resolver.TargetNamespace リゾルバー.受信場所名
Resolver.TransportType Resolver.TransportNamespace リゾルバー.ウィンドウユーザーフィールド
Resolver.CacheTimeout

リゾルバー マネージャーが Dictionary オブジェクト インスタンスを返した後、アダプター マネージャーはメッセージの特定の BizTalk アダプター コンテキスト プロパティを設定します。 ルーティング エージェントの次のコード フラグメントは、アダプター マネージャーを使用して送信メッセージのエンドポイント プロパティを設定する方法を示しています。

  
//XLANGs  
// Set the transport properties.  
transportLocation = resolverDictionary.Item("Resolver.TransportLocation");  
transportType = resolverDictionary.Item("Resolver.TransportType");  
  
// Create the delivery message.  
DeliveryMessage = InboundMessage;  
  
// Call the adapter manager to set all necessary properties on the message.  
Microsoft.Practices.ESB.Adapter.AdapterMgr.SetEndpoint(  
                                resolverDictionary,DeliveryMessage);  
  
// Set the delivery port address.  
DeliveryPort(Microsoft.XLANGs.BaseTypes.Address) = transportLocation;  
DeliveryPort(Microsoft.XLANGs.BaseTypes.TransportType) = transportType;  

ルーティング エージェントの次のコード フラグメントは、カスタム パイプライン コンポーネント内からアダプター マネージャーを使用して、送信メッセージのエンドポイント プロパティを設定する方法を示しています。

// Resolve the configuration for routing.  
ResolverDictionary = ResolverMgr.Resolve(info, pInMsg, pContext);  
  
// Call the adapter manager to set all required message properties.  
AdapterMgr.SetEndpoint(ResolverDictionary, pInMsg.Context);