/// <summary> /// The execute. /// </summary> /// <param name="context"> /// The context. /// </param> protected override void Execute(NativeActivityContext context) { this.hostContext = context.GetExtension <IHttpWorkflowHostContext>(); // Typically there is only one base address but there could be more than one. foreach (var bookmarkName in this.hostContext.BaseAddresses.Select(this.GetBookmarkName)) { context.CreateBookmark(bookmarkName, this.ReceiveCallback); context.Track(new HttpReceiveMessageRecord(bookmarkName)); } }
/// <summary> /// The receive callback. /// </summary> /// <param name="context"> /// The context. /// </param> /// <param name="bookmark"> /// The bookmark. /// </param> /// <param name="value"> /// The value. /// </param> private void ReceiveCallback(NativeActivityContext context, Bookmark bookmark, object value) { context.RemoveAllBookmarks(); this.receiveContext = (IHttpWorkflowReceiveContext)value; this.hostContext = context.GetExtension <IHttpWorkflowHostContext>(); // bind the parameters using the UriTemplate var match = this.hostContext.MatchSingle(this.receiveContext.Request); this.noPersistHandle.Get(context).Enter(context); // TODO: Consider fault handling - do we need to do anything special? context.ScheduleFunc( this.Body, this.receiveContext.Request, match.BoundVariables.AllKeys.ToDictionary(s => s, key => match.BoundVariables[key]), this.OnBodyCompleted); }
/// <summary> /// The receive callback. /// </summary> /// <param name="context"> /// The context. /// </param> /// <param name="bookmark"> /// The bookmark. /// </param> /// <param name="value"> /// The value. /// </param> private void ReceiveCallback(NativeActivityContext context, Bookmark bookmark, object value) { context.RemoveAllBookmarks(); this.receiveContext = (IHttpWorkflowReceiveContext)value; this.hostContext = context.GetExtension<IHttpWorkflowHostContext>(); // bind the parameters using the UriTemplate var match = this.hostContext.MatchSingle(this.receiveContext.Request); this.noPersistHandle.Get(context).Enter(context); // TODO: Consider fault handling - do we need to do anything special? context.ScheduleFunc( this.Body, this.receiveContext.Request, match.BoundVariables.AllKeys.ToDictionary(s => s, key => match.BoundVariables[key]), this.OnBodyCompleted); }
/// <summary> /// The execute. /// </summary> /// <param name="context"> /// The context. /// </param> protected override void Execute(NativeActivityContext context) { this.hostContext = context.GetExtension<IHttpWorkflowHostContext>(); // Typically there is only one base address but there could be more than one. foreach (var bookmarkName in this.hostContext.BaseAddresses.Select(this.GetBookmarkName)) { context.CreateBookmark(bookmarkName, this.ReceiveCallback); context.Track(new HttpReceiveMessageRecord(bookmarkName)); } }