Exemplo n.º 1
0
        public override IEnumerable <TDataType> Snapshot(AdapterReaderQos qos, QueryParameters queryParameters)
        {
            var waitHandle = new ManualResetEvent(false);

            using (var callback = new SnapshotCallback(waitHandle))
            {
                using (
                    var subcriber = new Subscriber <TDataType>(topic, queryParameters.Partition, qos, callback.Listener,
                                                               1000))
                {
                    waitHandle.WaitOne(Constants.RequestTimeout);
                    return(callback.DataItems);
                }
            }
        }
        public Guid Subscribe(FirebasePath path, string eventName, SnapshotCallback callback, object context, bool once,
                              IEnumerable <ISubscriptionFilter> filters)
        {
            var sub = new Subscription(_app, filters)
            {
                Event    = eventName,
                Callback = callback,
                Context  = context,
                Once     = once,
                Path     = path,
            };

            if (!once)
            {
                lock (_lock)
                {
                    _subscriptions.Add(sub);
                }
            }

            _syncDb.ExecuteInitial(sub);

            return(sub.SubscriptionId);
        }
Exemplo n.º 3
0
        public Guid Subscribe(FirebasePath path, string eventName, SnapshotCallback callback, object context, bool once,
            IEnumerable<ISubscriptionFilter> filters)
        {
            var sub = new Subscription(_app, filters)
            {
                Event = eventName,
                Callback = callback,
                Context = context,
                Once = once,
                Path = path,
            };

            if (!once)
            {
                lock (_lock)
                {
                    _subscriptions.Add(sub);
                }
            }

            _syncDb.ExecuteInitial(sub);

            return sub.SubscriptionId;
        }
Exemplo n.º 4
0
 internal Guid SubscribeOnce(string eventName, FirebasePath path, SnapshotCallback callback, object context,
     IEnumerable<ISubscriptionFilter> filters, FirebaseStatusCallback cancelledCallback)
 {
     return _subscriptions.Subscribe(path, eventName, callback, context, true, filters);
 }
Exemplo n.º 5
0
 public IFirebaseReadonlyQuery Once(string eventName, SnapshotCallback callback, object context,
                                    FirebaseStatusCallback cancelledCallback = null)
 {
     return(CreateQuery().Once(eventName, callback, context, cancelledCallback));
 }
Exemplo n.º 6
0
 internal Guid Subscribe(string eventName, FirebasePath path, SnapshotCallback callback, object context,
     IEnumerable<ISubscriptionFilter> filters)
 {
     return _subscriptions.Subscribe(path, eventName, callback, context, false, filters);
 }
Exemplo n.º 7
0
 internal void Fire(SnapshotCallback callback, DataSnapshot snap, object context)
 {
     _subProcessor.Add(callback, snap, context);
 }
Exemplo n.º 8
0
 public IFirebaseReadonlyQuery On(string eventName, SnapshotCallback callback, object context)
 {
     return(CreateQuery().On(eventName, callback, context));
 }
Exemplo n.º 9
0
 public IFirebaseReadonlyQuery Once(string eventName, SnapshotCallback callback, object context,
     FirebaseStatusCallback cancelledCallback = null)
 {
     return CreateQuery().Once(eventName, callback, context, cancelledCallback);
 }
Exemplo n.º 10
0
 internal Guid SubscribeOnce(string eventName, FirebasePath path, SnapshotCallback callback, object context,
                             IEnumerable <ISubscriptionFilter> filters, FirebaseStatusCallback cancelledCallback)
 {
     return(_subscriptions.Subscribe(path, eventName, callback, context, true, filters));
 }
Exemplo n.º 11
0
 public IFirebaseReadonlyQuery On(string eventName, SnapshotCallback callback)
 {
     return On(eventName, callback, null);
 }
Exemplo n.º 12
0
 public IFirebaseReadonlyQuery Once(string eventName, SnapshotCallback callback,
     FirebaseStatusCallback cancelledCallback = null)
 {
     return Once(eventName, callback, null, cancelledCallback);
 }
Exemplo n.º 13
0
 public IFirebaseReadonlyQuery On(string eventName, SnapshotCallback callback, object context)
 {
     _queryId = _app.Subscribe(eventName, _path, callback, context, _filters);
     return(this);
 }
Exemplo n.º 14
0
 public IFirebaseReadonlyQuery Once(string eventName, SnapshotCallback callback,
                                    FirebaseStatusCallback cancelledCallback = null)
 {
     return(Once(eventName, callback, null, cancelledCallback));
 }
Exemplo n.º 15
0
 public IFirebaseReadonlyQuery On(string eventName, SnapshotCallback callback)
 {
     return(On(eventName, callback, null));
 }
Exemplo n.º 16
0
 public void Add(SnapshotCallback callback, DataSnapshot snap, object context)
 {
     EnsureStarted();
     _queue.Enqueue(_token, new QueueSubscriptionEvent(callback, snap, context));
 }
Exemplo n.º 17
0
 public void Add(SnapshotCallback callback, DataSnapshot snap, object context)
 {
     EnsureStarted();
     _queue.Enqueue(_token, new QueueSubscriptionEvent(callback, snap, context));
 }
Exemplo n.º 18
0
 internal void Fire(SnapshotCallback callback, DataSnapshot snap, object context)
 {
     _subProcessor.Add(callback, snap, context);
 }
Exemplo n.º 19
0
 public IFirebaseReadonlyQuery On(string eventName, SnapshotCallback callback, object context)
 {
     return CreateQuery().On(eventName, callback, context);
 }
Exemplo n.º 20
0
 public IFirebaseReadonlyQuery Once(string eventName, SnapshotCallback callback, object context,
                                    FirebaseStatusCallback cancelledCallback = null)
 {
     _queryId = _app.SubscribeOnce(eventName, _path, callback, context, _filters, cancelledCallback);
     return(this);
 }
 public QueueSubscriptionEvent(SnapshotCallback callback, DataSnapshot snap, object context)
 {
     _callback = callback;
     _snap     = snap;
     _context  = context;
 }
Exemplo n.º 22
0
 public IFirebaseReadonlyQuery On(string eventName, SnapshotCallback callback, object context)
 {
     _queryId = _app.Subscribe(eventName, _path, callback, context, _filters);
     return this;
 }
Exemplo n.º 23
0
 public QueueSubscriptionEvent(SnapshotCallback callback, DataSnapshot snap, object context)
 {
     _callback = callback;
     _snap = snap;
     _context = context;
 }
Exemplo n.º 24
0
 public IFirebaseReadonlyQuery Once(string eventName, SnapshotCallback callback, object context,
     FirebaseStatusCallback cancelledCallback = null)
 {
     _queryId = _app.SubscribeOnce(eventName, _path, callback, context, _filters, cancelledCallback);
     return this;
 }
Exemplo n.º 25
0
 internal Guid Subscribe(string eventName, FirebasePath path, SnapshotCallback callback, object context,
                         IEnumerable <ISubscriptionFilter> filters)
 {
     return(_subscriptions.Subscribe(path, eventName, callback, context, false, filters));
 }