private void HandleResourceAvailable(ResourceAvailableMessage resourceAvailableMessage)
        {
            var resource            = resourceAvailableMessage.Resource;
            var timestampedResource = TimestampedResource.Create(resource);

            _availableResources.Enqueue(timestampedResource);
        }
        private void HandleAddResource(AddResourceMessage addResourceMessage)
        {
            // Only add the resource if we didn't already exceed the maximum
            var success = _availableResources.Count < _maxNumResources;

            if (success)
            {
                var resource            = addResourceMessage.Resource;
                var timestampedResource = TimestampedResource.Create(resource);
                _availableResources.Enqueue(timestampedResource);
            }

            addResourceMessage.ResultTaskCompletionSource.SetResult(success);
        }