# A problem with Multiple queues processing

**URL:** <https://discuss.hangfire.io/t/a-problem-with-multiple-queues-processing/277>\
**Category:** bug?\
**Tags:** configuration, queues\
**Created:** [October 7, 2014, 8:28am UTC](https://discuss.hangfire.io/t/a-problem-with-multiple-queues-processing/277 "2014-10-07T08:28:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MookieFumi](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/mookiefumi/32/73_2.png) [@MookieFumi](https://discuss.hangfire.io/u/MookieFumi)\
**Post date:** [October 7, 2014, 8:28am UTC](https://discuss.hangfire.io/t/a-problem-with-multiple-queues-processing/277/1 "2014-10-07T08:28:30Z")

</div>

Hi!

I’m doing the first tests with this incredible framework and I have encountered the following problem.

The queues do not work me, I have two queues (critical and default) and always performed the same queue.

It’s an empty MVC app. Any suggestions?

Owin startup class

```
            app.UseHangfire(config =>
        {
            config.UseSqlServerStorage("DemoContext");
            config.UseServer(queues: new[] { "critical", "default" });
        });

```

Controller

```
 public class HomeController : Controller
{
    public ActionResult Index()
    {
        WriteLine2("A message (default)");
        WriteLine("A message (critical)");
        return View();
    }

    [Queue("critical")]
    private static void WriteLine(string text)
    {
        BackgroundJob.Enqueue(() => Console.WriteLine(text));
    }

    private static void WriteLine2(string text)
    {
        BackgroundJob.Enqueue(() => Console.WriteLine(text));
    }
}
```

---

<div class="post-metadata">

**Author:** ![MookieFumi](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/mookiefumi/32/73_2.png) [@MookieFumi](https://discuss.hangfire.io/u/MookieFumi)\
**Post date:** [October 7, 2014, 9:21am UTC](https://discuss.hangfire.io/t/a-problem-with-multiple-queues-processing/277/2 "2014-10-07T09:21:06Z")

</div>

Sorry, I fixed the problem. It was a mistake because it did not understand how to do the job.

Startup owin class

```
            app.UseHangfire(config =>
        {
            //https://github.com/phenixdotnet/Hangfire.Unity
            var container = UnityConfig.GetConfiguredContainer() as UnityContainer;
            config.UseUnityActivator(container);

            config.UseSqlServerStorage("DemoContext");
            config.UseServer(queues: new[] { "critical", "default" });
        });

```

Controller

```
        public ActionResult Index()
    {
        BackgroundJob.Enqueue(() => _utilities.DoSomething(String.Empty));
        BackgroundJob.Enqueue(() => _utilities.DoSomethingElse(String.Empty));
        return View();
    }

```

Funcs to Queue

```
public interface IUtilities
{
    void DoSomething(string text);
    void DoSomethingElse(string text);
}

public class Utilities : IUtilities
{
    [Queue("critical")]
    public void DoSomething(string text)
    {
        Console.WriteLine(String.Format("DoSomething - {0}", text));
    }

    public void DoSomethingElse(string text)
    {
        System.Threading.Thread.Sleep(5000);
        Console.WriteLine(String.Format("DoSomethingElse - {0}", text));
    }
}

```

Close the post.  
Thanks.

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [July 27, 2015, 9:02am UTC](https://discuss.hangfire.io/t/a-problem-with-multiple-queues-processing/277/3 "2015-07-27T09:02:28Z")

</div>


