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); } } }
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); } } }
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); } } }
public abstract Task BasePublishAsync(string topic, EasyCachingMessage message, CancellationToken cancellationToken = default(CancellationToken));
public abstract void BasePublish(string topic, EasyCachingMessage message);