# Querying Awaiting State Status

**URL:** <https://discuss.hangfire.io/t/querying-awaiting-state-status/5027>\
**Category:** bug?\
**Tags:** sql-server\
**Created:** [August 17, 2018, 4:56pm UTC](https://discuss.hangfire.io/t/querying-awaiting-state-status/5027 "2018-08-17T16:56:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkohler21](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/kkohler21/32/1374_2.png) [@kkohler21](https://discuss.hangfire.io/u/kkohler21)\
**Post date:** [August 17, 2018, 4:56pm UTC](https://discuss.hangfire.io/t/querying-awaiting-state-status/5027/1 "2018-08-17T16:56:19Z")

</div>

How did i query the awaiting state?

My usecase: Only one file at a time can be processed.

My code is as follows:

```
  if (processingJobs.Any(x => x.Value.Job.Method.Name == Constants.FileProcessingMethod))
        {
            var parentjobID = processingJobs.LastOrDefault(x =>
                x.Value.Job.Method.Name == Constants.FileProcessingMethod).Key;
            JobManager.ContinueWithHangFire<BehaviorManager>(parentjobID,
                x => x.ProcessFileUploadActivityBehavior(activity.ActivityId));
        }
        else
        {
            JobManager.EnqueueHangFire<BehaviorManager>(x => x.ProcessFileUploadActivityBehavior(activity.ActivityId));
        }

```

The problem comes with the processing state. I also need a way to query for awaiting jobs. I thought the MonitorAPI call is getenqueuejob. The call requires a queue parameter. I never have any queues unless i force a job into one thats not default. If I use default i get no results.

![Fullscreen_081718_112436_AM](https://europe1.discourse-cdn.com/flex017/uploads/hangfire/original/2X/2/2d80812e2505016ac6bb7316d9d17e29e1a2ab81.jpg)

 ![Screenshot_081718_111756_AM](https://europe1.discourse-cdn.com/flex017/uploads/hangfire/original/2X/f/f8e9177fd7d75bb73c19eefeedc5d149061aa6ba.jpg)

I need to queue up jobs using the last awaiting state job.

I’m also ready to write my own sqlreading and by pass the api.

Thanks!

---

<div class="post-metadata">

**Author:** ![ebrnl](https://avatars.discourse-cdn.com/v4/letter/e/3d9bf3/32.png) [@ebrnl](https://discuss.hangfire.io/u/ebrnl)\
**Post date:** [October 12, 2023, 8:03am UTC](https://discuss.hangfire.io/t/querying-awaiting-state-status/5027/2 "2023-10-12T08:03:35Z")

</div>

Hi @kkohler21 is there any update about your question? I have the same logic as yours so I need to find jobs that are awaiting status but I couldn’t find a solution to get them.
