pegasus.eventbus.amqp.AmqpEnvelope.MarkAsProcessed C# (CSharp) Méthode

MarkAsProcessed() public méthode

public MarkAsProcessed ( ) : void
Résultat void
        public void MarkAsProcessed()
        {
            _waitEvent.Set();
        }

Usage Example

        protected void Deliver(AmqpEnvelope env)
        {
            try
            {
                LOG.DebugFormat("Now delivering to client(s): {0}", env);

                IEvent message = env.Open();

                // always check for interceptors first.  They're on a schedule, man.
                if (this.DoesNotIntercept(message))
                {
                    IEnumerable<IEventSubscription> subs = _subscriptions.For(message);

                    foreach (IEventSubscription sub in subs)
                    {
                        try
                        {
                            sub.Handler(message);
                        }
                        catch (Exception ex)
                        {
                            LOG.Error(string.Format("{0}{1}{2}",
                                "The event dispatcher caught an unhandled exception thrown by a client's event handler.  ",
                                "The event dispatcher is fine and message processing will continue, ",
                                "but the client that wanted to handle the event may not have done so."
                                ), ex);
                        }
                    }
                }

                // now, deliver the event to any wiretappers - even though it may have been
                // intercepted as a response for a request
                foreach (IEventSubscription sub in _wiretaps)
                {
                    try
                    {
                        sub.Handler(message);
                    }
                    catch (Exception ex)
                    {
                        LOG.Error(string.Format("{0}{1}{2}",
                            "The event dispatcher caught an unhandled exception thrown by a client's event handler.  ",
                            "The event dispatcher is fine and message processing will continue, ",
                            "but the client that wanted to handle the event may not have done so."
                            ), ex);
                    }
                }
            }
            catch (Exception ex)
            {
                LOG.Error(string.Format("{0}{1}{2}",
                    "The event dispatcher encountered an exception while trying to open an envelope and ",
                    "deliver it to subscribed clients.  The event dispatcher is fine and message processing ",
                    "will continue, but any clients wanting to handle the event will not get it.")
                    , ex);
            }
            finally
            {
                env.MarkAsProcessed();
            }
        }