예제 #1
0
        public virtual void BaseOnMessage(EasyCachingMessage message)
        {
            var       operationId = s_diagnosticListener.WriteSubscribeMessageBefore(new BeforeSubscribeMessageRequestEventData(message));
            Exception e           = null;

            try
            {
                _handler?.Invoke(message);
            }
            catch (Exception ex)
            {
                e = ex;
                throw;
            }
            finally
            {
                if (e != null)
                {
                    s_diagnosticListener.WritePublishMessageError(operationId, e);
                }
                else
                {
                    s_diagnosticListener.WritePublishMessageAfter(operationId);
                }
            }
        }
예제 #2
0
        public async Task PublishAsync(string topic, EasyCachingMessage message, CancellationToken cancellationToken = default(CancellationToken))
        {
            var       operationId = s_diagnosticListener.WritePublishMessageBefore(new BeforePublishMessageRequestEventData(topic, message));
            Exception e           = null;

            try
            {
                await BasePublishAsync(topic, message, cancellationToken);
            }
            catch (Exception ex)
            {
                e = ex;
                throw;
            }
            finally
            {
                if (e != null)
                {
                    s_diagnosticListener.WritePublishMessageError(operationId, e);
                }
                else
                {
                    s_diagnosticListener.WritePublishMessageAfter(operationId);
                }
            }
        }
예제 #3
0
        public void Publish(string topic, EasyCachingMessage message)
        {
            var       operationId = s_diagnosticListener.WritePublishMessageBefore(new BeforePublishMessageRequestEventData(topic, message));
            Exception e           = null;

            try
            {
                BasePublish(topic, message);
            }
            catch (Exception ex)
            {
                e = ex;
                throw;
            }
            finally
            {
                if (e != null)
                {
                    s_diagnosticListener.WritePublishMessageError(operationId, e);
                }
                else
                {
                    s_diagnosticListener.WritePublishMessageAfter(operationId);
                }
            }
        }
예제 #4
0
 public abstract Task BasePublishAsync(string topic, EasyCachingMessage message, CancellationToken cancellationToken = default(CancellationToken));
예제 #5
0
 public abstract void BasePublish(string topic, EasyCachingMessage message);