# Multiple Servers, with different filters

**URL:** <https://discuss.hangfire.io/t/multiple-servers-with-different-filters/10990>\
**Category:** question\
**Tags:** queues\
**Created:** [October 30, 2024, 7:02am UTC](https://discuss.hangfire.io/t/multiple-servers-with-different-filters/10990 "2024-10-30T07:02:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leijp](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/leijp/32/3838_2.png) [@Leijp](https://discuss.hangfire.io/u/Leijp)\
**Post date:** [October 30, 2024, 7:02am UTC](https://discuss.hangfire.io/t/multiple-servers-with-different-filters/10990/1 "2024-10-30T07:02:39Z")

</div>

Hello,

Im developping a Addin for an Application which already starts a Hangfire instance on SQL Server.  
This Server (with multiple queues) uses a .UseFilter

I can add an other Server (InMemory, and use a Filter)

```auto
            services.AddSingleton((provider) => new BackgroundJobFactory(provider.GetRequiredService<IJobFilterProvider>()));
            services.AddSingleton((provider) => new BackgroundJobStateChanger(provider.GetRequiredService<IJobFilterProvider>()));
            services.AddSingleton((provider) =>
            {
                IJobFilterProvider filterProvider = provider.GetRequiredService<IJobFilterProvider>();
                JobActivator activator = provider.GetRequiredService<JobActivator>();
                return new ABackgroundJobPerformer(filterProvider, activator, null);
            });

            services.AddHangfire((serviceProvider, config) =>
            {
                config
                    .UseInMemoryStorage()
                    .UseActivator(new AIOAspNetCoreJobActivator(serviceProvider.GetService<IServiceScopeFactory>()))
                    .UseFilter(new AExportJobFilter(serviceProvider));
            });

            AutomaticRetryAttribute retrySettings = GlobalJobFilters.Filters
                    .OfType<JobFilter>()
                    .First((JobFilter f) => f.Instance is AutomaticRetryAttribute).Instance as AutomaticRetryAttribute;
            retrySettings.Attempts = 3;
            services.AddHangfireServer((serviceProvider, options) =>
            {
                options.SchedulePollingInterval = TimeSpan.FromMinutes(1.0);
                options.Queues = new[] { "a-queue" };
                options.WorkerCount = 5; // Adjust worker count as needed for A-Server
            });

```

My job class:

```auto
        [Queue("a-queue")]
        public void PostUsersToAJob()
        {
            Debug.WriteLine("Posting");
        }

```

My JobFilter class:

```auto
    internal class AExportJobFilter : JobFilterAttribute, IElectStateFilter, IClientFilter
   {
        public void OnCreated(CreatedContext filterContext)
        {
         }

        public void OnCreating(CreatingContext filterContext)
        {
           //Do something, Im not hit!
        }
   }

```

```auto
RecurringJob.AddOrUpdate<AJobs>(
                nameof(AIOJobs.PostUsersToAJob),
                "a-queue",
                job => job.PostUsersToAJob(),
                Cron.Minutely);

```

I the hangfire dashboard, i see the two server, with their Queues.  
Also i see the job created, with in parentheses “a-queue”

I did expect, whilst using the `.UseFilter` on my hangfile server with the `a-queue` that this job will be handled by the `AJobExportJobFilter`.

But, the job is being handled by the other, which is not under my control, JobFilter of the other party.

Did i miss something?
