public virtual void Start(ITransaction transaction, bool forked)
        {
            // Catch all exceptions because Start could be used as public API
            try
            {
                Context ctx = GetContext();

                if (ctx != null)
                {
                    ctx.Start(transaction, forked);

                    if (transaction is ITaggedTransaction)
                    {
                        ITaggedTransaction tt = (ITaggedTransaction)transaction;
                        _mTaggedTransactions.Set(tt.Tag, tt);
                    }
                }
                else if (_mFirstMessage)
                {
                    _mFirstMessage = false;
                    Logger.Info("CAT client is not enabled because it's not initialized yet");
                }
                else
                {
                    Logger.Warn("Failed to get current context to start a transaction with. transaction: " + transaction);
                }
            }
            catch (Exception ex)
            {
                Cat.lastException = ex;
            }
        }
        public void Bind(string tag, string title)
        {
            ITaggedTransaction t = _mTaggedTransactions.Get(tag);

            if (t != null)
            {
                IMessageTree tree = ThreadLocalMessageTree;
                if (null != tree)
                {
                    t.Start();
                    t.Bind(tag, tree.MessageId, title);
                }
            }
        }
Ejemplo n.º 3
0
        public virtual void Start(ITransaction transaction, bool forked)
        {
            Context ctx = GetContext();

            if (ctx != null)
            {
                ctx.Start(this, transaction, forked);

                if (transaction is DefaultTaggedTransaction)
                {
                    ITaggedTransaction tt = transaction as DefaultTaggedTransaction;
                    _taggedTransactions[tt.Tag] = tt;
                }
            }
            else if (_firstMessage)
            {
                _firstMessage = false;
                Logger.Warn("CAT client is not enabled because it's not initialized yet");
            }
        }
Ejemplo n.º 4
0
        public void Bind(string tag, string title)
        {
            ITaggedTransaction t = null;

            if (_taggedTransactions.TryGetValue(tag, out t))
            {
                IMessageTree tree = ThreadLocalMessageTree;

                if (tree != null)
                {
                    if (tree.MessageId == null)
                    {
                        tree.MessageId = NextMessageId();
                    }

                    t.Start();
                    t.Bind(tag, tree.MessageId, title);
                }
            }
        }