public FailedThresholdCallbackNotifier(
     IOptions <AbpCAPEventBusOptions> options,
     IExceptionNotifier exceptionNotifier)
 {
     Options           = options.Value;
     ExceptionNotifier = exceptionNotifier;
 }
 public AzureServiceBusMessageConsumer(
     IExceptionNotifier exceptionNotifier,
     IProcessorPool processorPool)
 {
     _exceptionNotifier = exceptionNotifier;
     _processorPool     = processorPool;
     Logger             = NullLogger <AzureServiceBusMessageConsumer> .Instance;
     _callbacks         = new ConcurrentBag <Func <ServiceBusReceivedMessage, Task> >();
 }
示例#3
0
        public KafkaMessageConsumer(
            IConsumerPool consumerPool,
            IExceptionNotifier exceptionNotifier,
            IOptions <AbpKafkaOptions> options)
        {
            ConsumerPool      = consumerPool;
            ExceptionNotifier = exceptionNotifier;
            Options           = options.Value;
            Logger            = NullLogger <KafkaMessageConsumer> .Instance;

            Callbacks = new ConcurrentBag <Func <Message <string, byte[]>, Task> >();
        }
示例#4
0
        public RocketTimer()
        {
            ExceptionNotifier = NullExceptionNotifier.Instance;
            Logger            = NullLogger <RocketTimer> .Instance;

            _taskTimer = new Timer(
                TimerCallBack,
                null,
                Timeout.Infinite,
                Timeout.Infinite
                );
        }
示例#5
0
 public ErrorController(
     IExceptionToErrorInfoConverter exceptionToErrorInfoConverter,
     IHttpExceptionStatusCodeFinder httpExceptionStatusCodeFinder,
     IOptions <AbpErrorPageOptions> abpErrorPageOptions,
     IStringLocalizer <AbpUiResource> localizer,
     IExceptionNotifier exceptionNotifier)
 {
     _errorInfoConverter  = exceptionToErrorInfoConverter;
     _statusCodeFinder    = httpExceptionStatusCodeFinder;
     _localizer           = localizer;
     _exceptionNotifier   = exceptionNotifier;
     _abpErrorPageOptions = abpErrorPageOptions.Value;
 }
示例#6
0
        public static Task NotifyAsync(
            [NotNull] this IExceptionNotifier exceptionNotifier, [NotNull] Exception exception,
            LogLevel?logLevel = null,
            bool handled      = true)
        {
            Check.NotNull(exceptionNotifier, nameof(exceptionNotifier));

            return(exceptionNotifier.NotifyAsync(
                       new ExceptionNotificationContext(
                           exception,
                           logLevel,
                           handled
                           )
                       ));
        }
 /// <summary>
 /// 初始化一个<see cref="TestController"/>类型的实例
 /// </summary>
 public TestController(ITestService testService
                       , IProcessingServer processingServer
                       , IMessageEventBus messageEventBus
                       , IAdminUnitOfWork unitOfWork
                       , IExceptionNotifier exceptionNotifier
                       , ILogger <TestController> logger
                       , ILog <TestController> otherLog)
 {
     TestService       = testService;
     ProcessingServer  = processingServer;
     MessageEventBus   = messageEventBus;
     UnitOfWork        = unitOfWork;
     ExceptionNotifier = exceptionNotifier;
     Logger            = logger;
     OtherLog          = otherLog;
 }
示例#8
0
        public RabbitMqMessageConsumer(
            IConnectionPool connectionPool,
            RocketTimer timer,
            IExceptionNotifier exceptionNotifier)
        {
            ConnectionPool    = connectionPool;
            Timer             = timer;
            ExceptionNotifier = exceptionNotifier;
            Logger            = NullLogger <RabbitMqMessageConsumer> .Instance;

            QueueBindCommands = new ConcurrentQueue <QueueBindCommand> ();
            Callbacks         = new ConcurrentBag <Func <IModel, BasicDeliverEventArgs, Task> > ();

            Timer.Period     = 5000; //5 sec.
            Timer.Elapsed   += Timer_Elapsed;
            Timer.RunOnStart = true;
        }
示例#9
0
        public async Task <Result> InsertNewMatchesForSeason(IExceptionNotifier exceptionNotifier, IRootAggregateRepository <FootballTeam> rootAggregateRepositoryFootBallTeam, string seasonIdForFootballMatches, List <FootBallMatch> footBallMatches)
        {
            Result vtr = new Result(true);

            try
            {
                bool footballMatchesAreValid = footBallMatches?.Any() ?? false;
                bool seasonIdIsValid         = !String.IsNullOrWhiteSpace(seasonIdForFootballMatches);
                if (!footballMatchesAreValid || !seasonIdIsValid)
                {
                    List <string> invalidArguments = new List <string>();
                    if (!footballMatchesAreValid)
                    {
                        invalidArguments.Add(nameof(footBallMatches));
                    }

                    if (!seasonIdIsValid)
                    {
                        invalidArguments.Add(nameof(seasonIdForFootballMatches));
                    }

                    vtr.SetErrorInvalidArguments(invalidArguments.ToArray());
                }
                else
                {
                    if (SeasonIdForFootballMatches?.Equals(seasonIdForFootballMatches, StringComparison.OrdinalIgnoreCase) ?? false)
                    {
                        vtr.SetError($"Matches with season id {seasonIdForFootballMatches} have already been added");
                    }
                    else
                    {
                        SeasonIdForFootballMatches    = seasonIdForFootballMatches;
                        JSListOfFootBallMatch_Matches = footBallMatches.SerializeToJson();
                        LastUpdateOfSeasonMatches     = DateTime.UtcNow;
                        vtr = await rootAggregateRepositoryFootBallTeam.Update(this);
                    }
                }
            }
            catch (Exception ex)
            {
                await exceptionNotifier.Notify(ex, vtr);
            }
            return(vtr);
        }
示例#10
0
    public KafkaMessageConsumer(
        IConsumerPool consumerPool,
        IExceptionNotifier exceptionNotifier,
        IOptions <AbpKafkaOptions> options,
        IProducerPool producerPool,
        AbpAsyncTimer timer)
    {
        ConsumerPool      = consumerPool;
        ExceptionNotifier = exceptionNotifier;
        ProducerPool      = producerPool;
        Timer             = timer;
        Options           = options.Value;
        Logger            = NullLogger <KafkaMessageConsumer> .Instance;

        Callbacks = new ConcurrentBag <Func <Message <string, byte[]>, Task> >();

        Timer.Period     = 5000; //5 sec.
        Timer.Elapsed    = Timer_Elapsed;
        Timer.RunOnStart = true;
    }
示例#11
0
文件: JobQueue.cs 项目: younes21/abp
    public JobQueue(
        IOptions <AbpBackgroundJobOptions> backgroundJobOptions,
        IOptions <AbpRabbitMqBackgroundJobOptions> rabbitMqAbpBackgroundJobOptions,
        IChannelPool channelPool,
        IRabbitMqSerializer serializer,
        IBackgroundJobExecuter jobExecuter,
        IServiceScopeFactory serviceScopeFactory,
        IExceptionNotifier exceptionNotifier)
    {
        AbpBackgroundJobOptions         = backgroundJobOptions.Value;
        AbpRabbitMqBackgroundJobOptions = rabbitMqAbpBackgroundJobOptions.Value;
        Serializer          = serializer;
        JobExecuter         = jobExecuter;
        ServiceScopeFactory = serviceScopeFactory;
        ExceptionNotifier   = exceptionNotifier;
        ChannelPool         = channelPool;

        JobConfiguration   = AbpBackgroundJobOptions.GetJob(typeof(TArgs));
        QueueConfiguration = GetOrCreateJobQueueConfiguration();

        Logger = NullLogger <JobQueue <TArgs> > .Instance;
    }
示例#12
0
        public async Task <Result> AddFullTimeLiveMatchStats(IExceptionNotifier exceptionNotifier, IRootAggregateRepository <FootballTeam> rootAggregateRepositoryFootballTeam, LiveMatchStats fullTimeLiveMatchStats)
        {
            Result vtr = new Result();

            try
            {
                if (fullTimeLiveMatchStats == null || String.IsNullOrWhiteSpace(fullTimeLiveMatchStats.MatchId))
                {
                    vtr.SetErrorInvalidArguments(nameof(fullTimeLiveMatchStats));
                }
                else
                {
                    if (fullTimeLiveMatchStats.MatchStatus != MatchStatus.FullTime)
                    {
                        vtr.SetError("Match is not over yet");
                    }
                    else
                    {
                        List <FootBallMatch> matches    = JSListOfFootBallMatch_Matches.DeserializeFromJson <List <FootBallMatch> >();
                        FootBallMatch        matchToSet = matches.FirstOrDefault(m => m.MatchId == fullTimeLiveMatchStats.MatchId);
                        if (matchToSet == null)
                        {
                            vtr.SetError($"Match with match id {fullTimeLiveMatchStats.MatchId} was not found");
                        }
                        else
                        {
                            matchToSet.FullTimeMatchStats = fullTimeLiveMatchStats;
                            JSListOfFootBallMatch_Matches = matches.SerializeToJson();
                            vtr = await rootAggregateRepositoryFootballTeam.Update(this);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                await exceptionNotifier.Notify(ex, vtr);
            }
            return(vtr);
        }
 public AbpEmailingExceptionSubscriber_Test()
 {
     _notifier = GetRequiredService <IExceptionNotifier>();
 }