Ejemplo n.º 1
0
        public Task <MessageNumber> GetLastMessageNumber(string resourceName)
        {
            var eventTracking = _eventTrackingList.SingleOrDefault(x => x.ResourceName == resourceName);

            if (eventTracking == null)
            {
                eventTracking = EventTracking.New(resourceName);
                _eventTrackingList.Add(eventTracking);
            }

            return(Task.FromResult(eventTracking.LastMessageNumber));
        }
Ejemplo n.º 2
0
        public async Task <MessageNumber> GetLastMessageNumber(string resourceName)
        {
            await using var connection = new NpgsqlConnection(Database.ConnectionString);
            await connection.OpenAsync();

            var eventTracking = await GetEventTracking(resourceName);

            if (eventTracking == null)
            {
                eventTracking = EventTracking.New(resourceName);
                await SaveAsync(eventTracking);
            }

            return(eventTracking.LastMessageNumber);
        }