コード例 #1
0
        /// <summary>
        /// Send request message back to caller as response
        /// </summary>
        /// <param name="pipelineContext">Pipeline context</param>
        /// <param name="inputMessage">Input message</param>
        /// <returns>Original input message</returns>
        protected override IBaseMessage Execute(IPipelineContext pipelineContext, IBaseMessage inputMessage)
        {
            var callToken = TraceProvider.Logger.TraceIn(this.Name);

            try
            {
                // delegate work to the BizTalk Xml Dissassembler
                TraceProvider.Logger.TraceInfo("Checking if itinerary should be terminated");
                var IsTerminateItinerary = inputMessage.Context.Read("IsTerminateItinerary", "https://DE.DAXFSA.Framework.Properties.ESBGlobalProperties");

                if (IsTerminateItinerary != null && (bool)IsTerminateItinerary)
                {
                    IItinerary itinerary = ItineraryOMFactory.Create(inputMessage);
                    if (itinerary != null)
                    {
                        MethodInfo CompleteItinerary_MI = itinerary.GetType().GetMethod("CompleteItinerary", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                        if (CompleteItinerary_MI != null)
                        {
                            CompleteItinerary_MI.Invoke(itinerary, new object[] { null });
                        }
                    }
                    return(null);
                }
                return(inputMessage);
            }
            catch (Exception ex)
            {
                // put component name as a source information in this exception,
                // so the event log in message could reflect this
                ex.Source = this.Name;
                TraceProvider.Logger.TraceError(ex);
                throw ex;
            }
            finally
            {
                TraceProvider.Logger.TraceOut(callToken);
            }
        }