Example #1
0
            public void Enqueue(PendingWork work)
            {
                var entry = s_pool.Allocate();

                entry.Value = work;

                lock (_gate)
                {
                    Enqueue_NoLock(entry);
                }
            }
Example #2
0
            public bool TryGetWorkItem(int currentTime, out PendingWork pendingWork)
            {
                pendingWork = default;

                lock (_gate)
                {
                    if (!ContainsMoreWork_NoLock(currentTime))
                    {
                        return(false);
                    }

                    pendingWork = Dequeue_NoLock();
                    return(true);
                }
            }
        public async Task <HttpContent> ProcessPendingWork(Payload Payload, AuthenticationResponse AuthenticationResponse, PushTopic PushTopic)
        {
            SalesforceObjects.PendingServiceRouting PendingServiceRouting = JsonConvert.DeserializeObject <SalesforceObjects.PendingServiceRouting> (JsonConvert.SerializeObject(PushTopic.SObject));
            string SObjectPrefix = PendingServiceRouting.WorkItemId.Substring(0, 3);
            Dictionary <string, string> PrefixList = await this.RetrieveSObjects(AuthenticationResponse);

            string      SObjectType = PrefixList.Where(Prefix => Prefix.Key == SObjectPrefix).FirstOrDefault().Value;
            WorkItem    WorkItem    = new WorkItem(PendingServiceRouting.WorkItemId, SObjectType);
            PendingWork PendingWork = new PendingWork(PendingServiceRouting.Id, PendingServiceRouting.CreatedDate.ToString(), PendingServiceRouting.LastModifiedDate.ToString(), "create", WorkItem);

            Payload.pendingWork = PendingWork;
            string Content = JsonConvert.SerializeObject(Payload);

            return(new StringContent(Content, Encoding.UTF8, "application/json"));
        }
            public bool TryGetWorkItem(int currentTime, out PendingWork pendingWork)
            {
                pendingWork = default(PendingWork);

                lock (_gate)
                {
                    if (!ContainsMoreWork_NoLock(currentTime))
                    {
                        return false;
                    }

                    pendingWork = Dequeue_NoLock();
                    return true;
                }
            }
            public void Enqueue(PendingWork work)
            {
                var entry = s_pool.Allocate();
                entry.Value = work;

                lock (_gate)
                {
                    Enqueue_NoLock(entry);
                }
            }