Ejemplo n.º 1
0
        /// <summary>
        /// Execute  (pipeline component entry)
        /// </summary>
        /// <param name="context"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public IBaseMessage Execute(IPipelineContext context, IBaseMessage message)
        {
            WriteTrace(string.Format("Inside execute of \"{0}\"", Name));

            if (string.IsNullOrEmpty(this.Tag) || string.IsNullOrWhiteSpace(this.Tag))
            {
                this.Tag = "||||";
            }

            try
            {
                // Archive the message.
                ArchiveManager archiveManager = new ArchiveManager();

                string messageId = archiveManager.ArchiveMessage(context, message, 0, true, this.Tag);
                WriteTrace("Message Id: '" + messageId + "' has been archived.");

                SetMetadata(message, this.Tag, messageId);
            }
            catch (Exception exception)
            {
                WriteTrace(string.Format("Error occured in {0} \r\n Details: {1}", Name, exception.ToString()));
                throw exception;
            }
            return(message);
        }
Ejemplo n.º 2
0
        public IBaseMessage Execute(IPipelineContext pipelineContext, IBaseMessage message, string resolverString, IItineraryStep step)
        {
            Logger.WriteTrace(string.Format("******{0} Started******", this.GetType().Name));
            Logger.WriteTrace("Resolver String: " + resolverString);

            if (string.IsNullOrEmpty(resolverString))
            {
                throw new ArgumentException("ResolverString is required.", "resolverString");
            }
            try
            {
                ResolverInfo info = ResolverMgr.GetResolverInfo(ResolutionType.Transform, resolverString);
                if (info.Success)
                {
                    Dictionary <string, string> dictionary = ResolverMgr.Resolve(info, message, pipelineContext);

                    // Archive the message.
                    ArchiveManager archiveManager = new ArchiveManager();

                    int    expiryMinutes     = Convert.ToInt32(dictionary["Archive.ExpiryMinutes"]);
                    bool   includeProperties = Convert.ToBoolean(dictionary["Archive.IncludeProperties"]);
                    string failureEventId    = dictionary["Archive.FailureEventId"];
                    string tag           = dictionary["Archive.Tag"];
                    string failureAction = dictionary["Archive.FailureAction"];

                    string messageId = archiveManager.ArchiveMessage(pipelineContext, message, expiryMinutes, includeProperties, tag);
                    Logger.WriteTrace("Message Id: '" + messageId + "' has been archived.");

                    SetMetadata(message, tag, messageId);
                }
                else
                {
                    throw new Exception("Unable to get archive resolver information from the resolver string: " + resolverString);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteTrace(string.Format("Error occured in {0} \r\n Details: {1}", this.GetType().Name, ex.ToString()));
                throw ex;
            }
            Logger.WriteTrace(string.Format("******{0} Completed******", this.GetType().Name));
            return(message);
        }