I have re-implemented Hangfire manually
Can you share your code?
Maybe you should move some code to
DbMigrator
module.
I can share the code. How do I send it?
hi
Can you try https://github.com/abpframework/abp/issues/11069 ?
Hello, I have re-implemented Hangfire manually, as the documentation suggested, and I can even see the dashboard running. However, the DbMigrator exits with the following error:
Unhandled exception. Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.Hangfire.AbpHangfireModule, Volo.Abp.HangFire, Version=6.0.1.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating λ:Volo.Abp.Hangfire.AbpHangfireBackgroundJobServer -> λ:Hangfire.JobStorage.. See the inner exception for details.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating λ:Volo.Abp.Hangfire.AbpHangfireBackgroundJobServer -> λ:Hangfire.JobStorage.
---> System.InvalidOperationException: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.
at Hangfire.JobStorage.get_Current()
at Hangfire.HangfireServiceCollectionExtensions.<>c.<AddHangfire>b__1_0(IServiceProvider _)
at Hangfire.HangfireServiceCollectionExtensions.<>c__DisplayClass13_0`1.<TryAddSingletonChecked>b__0(IServiceProvider serviceProvider)
at Autofac.Extensions.DependencyInjection.AutofacRegistration.<>c__DisplayClass3_0.<Register>b__0(IComponentContext context, IEnumerable`1 parameters)
...
I'm not sure what JobStorage
does it require. I'm using PostgresSQL as a database server, and I can see Hangfire has created a separate schema in the database to host its data. Any clues on what can it be?
Also, please suggest what's the proper place in the solution to implement Hangfire logic/jobs?
We have a tiered app/solution generated with ABP Suite. We're looking to add Hangfire support to this solution. Following the documentation that describes the steps (https://docs.abp.io/en/abp/latest/Background-Jobs-Hangfire), we were able to install the package with ABP CLI, as suggested. My understanding is that we don't need to do anything extra. When we run the solution it fails at runtime with the following error:
Volo.Abp.AbpInitializationException
HResult=0x80131500
Message=An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.Hangfire.AbpHangfireModule, Volo.Abp.HangFire, Version=6.0.1.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating λ:Volo.Abp.Hangfire.AbpHangfireBackgroundJobServer -> λ:Hangfire.JobStorage.. See the inner exception for details.
Source=Volo.Abp.Core
StackTrace:
at Volo.Abp.Modularity.ModuleManager.<InitializeModulesAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.AbpApplicationBase.<InitializeModulesAsync>d__19.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.AbpApplicationWithInternalServiceProvider.<InitializeAsync>d__7.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at _3M.DbMigrator.DbMigratorHostedService.<StartAsync>d__3.MoveNext() in D:\_Sources\MyAbilities\3Motion\_3M\aspnet-core\src\_3M.DbMigrator\DbMigratorHostedService.cs:line 32
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__12.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at _3M.DbMigrator.Program.<Main>d__0.MoveNext() in D:\_Sources\MyAbilities\3Motion\_3M\aspnet-core\src\_3M.DbMigrator\Program.cs:line 28
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
DependencyResolutionException: An exception was thrown while activating λ:Volo.Abp.Hangfire.AbpHangfireBackgroundJobServer -> λ:Hangfire.JobStorage.
Inner Exception 2:
InvalidOperationException: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.
Steps to reproduce:
Questions:
Hi, How do we ensure that the data from many Tenant's databases go to Elasticsearch?
Hi,
Why not create a reporting service(module), it has a separate database or NoSQL database, like Elasticsearch? in this way you don't have to query hundreds of tenant databases to get reports.
About performance,
You can create a background worker to generate reports periodically, when you query, it's ready immediately. (not used for real-time reporting)
Hi! Could you elaborate on the first option, please? I didn't quite get how we benefit from the separate service + database (or ElasticSearch service). Do you have any useful links/references that may help us clarify this approach? Thanks!
We're looking to create a proper reporting solution on top of a tiered ABP template/application. We're not interested in searching/evaluating reporting components per se at this stage, but rather we're looking for a general approach to organizing reporting. Here are some inputs/given:
We need to build some simple tenant-specific reports. Let's take the "file upload" functionality as a hypothetical example. Tenants need to know how many files they have uploaded daily/monthly/annually, etc. In this case, reporting is not a big deal as we can query this data from the tenant's database context. Reporting becomes a problem when we have hundreds of tenants with their own/dedicated database, and we (as a service provider) need to gather aggregated data from all those tenants (and display it on the back-office site). What's the recommended approach in this case? Creating a Data Warehouse? Also, querying against the live transactional DB is not a good idea, given that report generation may spoil the user experience and affect the app's performance. For this matter, a read-only replica for reporting solution would be a better idea, but it doesn't help much with many tenants who have a dedicated database. What's ABP's recommendation here?