public void Init()
        {
            var storage = new RealmJobStorage(new RealmJobStorageOptions
            {
                RealmConfiguration = ConnectionUtils.GetRealmConfiguration()
            });

            _realm = storage.GetRealm();
            _realm.Write(() => _realm.RemoveAll());
            _monitoringApi = new RealmMonitoringApi(storage);
        }
Example #2
0
        public void Init()
        {
            var storage = new RealmJobStorage(new RealmJobStorageOptions()
            {
                RealmConfiguration = ConnectionUtils.GetRealmConfiguration()
            });

            _realm       = storage.GetRealm();
            _transaction = new RealmWriteOnlyTransaction(storage);
            _realm.Write(() => _realm.RemoveAll());
        }
        public void Init()
        {
            _storage = new RealmJobStorage(new RealmJobStorageOptions()
            {
                RealmConfiguration = ConnectionUtils.GetRealmConfiguration()
            });
            _connection = new RealmStorageConnection(_storage);
            var realm = _storage.GetRealm();

            realm.Write(() => realm.RemoveAll());
        }
        public static IGlobalConfiguration <RealmJobStorage> UseRealmJobStorage(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] RealmJobStorageOptions options)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var storage = new RealmJobStorage(options);

            return(configuration.UseStorage(storage));
        }
        private RealmFetchedJob(
            [NotNull] RealmJobStorage storage,
            [NotNull] string id,
            [NotNull] string jobId,
            [NotNull] string queue,
            [NotNull] DateTimeOffset?fetchedAt)
        {
            if (fetchedAt == null)
            {
                throw new ArgumentNullException(nameof(fetchedAt));
            }
            _storage  = storage ?? throw new ArgumentNullException(nameof(storage));
            _id       = id ?? throw new ArgumentNullException(nameof(id));
            JobId     = jobId ?? throw new ArgumentNullException(nameof(jobId));
            Queue     = queue ?? throw new ArgumentNullException(nameof(queue));
            FetchedAt = fetchedAt.Value;

            if (storage.SlidingInvisibilityTimeout.HasValue)
            {
                var keepAliveInterval =
                    TimeSpan.FromSeconds(storage.SlidingInvisibilityTimeout.Value.TotalSeconds / 5);
                _timer = new Timer(ExecuteKeepAliveQuery, null, keepAliveInterval, keepAliveInterval);
            }
        }
 public static RealmFetchedJob CreateInstance(RealmJobStorage storage, string id, string jobId, string queue, DateTimeOffset?fetchedAt)
 {
     return(new RealmFetchedJob(storage, id, jobId, queue, fetchedAt));
 }
Example #7
0
 public ExpirationManager(RealmJobStorage storage, TimeSpan checkInterval)
 {
     _storage       = storage ?? throw new ArgumentNullException(nameof(storage));
     _checkInterval = checkInterval;
 }
Example #8
0
 public RealmMonitoringApi(RealmJobStorage storage)
 {
     _storage = storage ?? throw new ArgumentNullException(nameof(storage));
 }
 public RealmJobQueue([NotNull] RealmJobStorage storage)
 {
     _storage = storage ?? throw new ArgumentNullException(nameof(storage));
 }