I can see the same kind of behaviour post-deployment as well. Should I share the logs for same as well ?
hi
Please share the
logs.txt
to liming.ma@volosoft.comThanks
Done !!!
Hi maliming
BackgroundJobsDbContext
always creates and maintains jobs on the Host side.
How does the job know for which tenant it needs to be executed?
Can you prepare a template project to reproduce? liming.ma@volosoft.com
The project which I am working on is very complicated and not easy to mimic. Please let me know if you can connect over the call to have a look yourself.
The requirement is tenant-specific. Background job needs to be executed for only specific tenants. Not for all tenants, And that too on the trigger of some action.
And why is the IsAbandoned
field set to false? And I am not sure why the errors were not logged.
Hi,
This is my BackgroundJob
namespace SCV.Litmus.InvoiceManagement.BackgroundJobs
{
public class QuoteJob : AsyncBackgroundJob<CreateQuoteInputDto>, ITransientDependency
{
private readonly IQuoteAppService _quoteAppService;
public QuoteJob(IQuoteAppService quoteAppService)
{
_quoteAppService = quoteAppService;
}
public override async Task ExecuteAsync(CreateQuoteInputDto input)
{
Log.Information($"QuoteJob.ExecuteAsync started...");
await _quoteAppService.CreateQuoteAsync(input);
Log.Information($"QuoteJob.ExecuteAsync ended...");
}
}
}
And this is the call from an AppService
await _backgroundJobManager.EnqueueAsync(quoteInput);
Logs in the ExecuteAsync()
were not found in Cloudwatch.
Also, there were no warning/error logs found post executing this code
In the AbpBackgroundJobs table, There were no entries in the Tenant_Admin tables But there were 2 entries in the Host_Admin tables PFB screenshot below
Job Arg :
{
"financeAmount": 478943.95,
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"businessEntityId": "fb24fde8-c0a5-4e38-8f4f-27bc17868497",
"userId": "fd57be54-05ad-7168-cfb5-39f6066901cf",
"invoices": [
{
"invoiceId": "3a0b3d47-325c-15b0-a702-907606d81e42",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"businessEntityId": "fb24fde8-c0a5-4e38-8f4f-27bc17868497",
"description": "",
"isActive": true,
"id": 1340186
},
{
"invoiceId": "3a0b3d47-3438-04c2-0395-ef2c7e309305",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"businessEntityId": "fb24fde8-c0a5-4e38-8f4f-27bc17868497",
"description": "",
"isActive": true,
"id": 1340187
},
{
"invoiceId": "3a0b3d47-4fbd-2a6e-63df-b0982c6ca342",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"businessEntityId": "fb24fde8-c0a5-4e38-8f4f-27bc17868497",
"description": "",
"isActive": true,
"id": 1340188
},
{
"invoiceId": "3a0b3824-948a-0366-7881-670d0f2cd185",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"businessEntityId": "fb24fde8-c0a5-4e38-8f4f-27bc17868497",
"description": "",
"isActive": true,
"id": 1340189
},
{
"invoiceId": "3a0b32fc-b6eb-9419-b543-aeaf3dd18c9b",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"businessEntityId": "fb24fde8-c0a5-4e38-8f4f-27bc17868497",
"description": "",
"isActive": true,
"id": 1340190
}
],
"creditNotes": [],
"invoiceList": [
{
"tenantId": "d1be844b-d3a2-031a-f036-39f5d4380239",
"invoiceNumber": "8212395854",
"invoiceAdditionalReference": "0700162451",
"invoiceUniqueId": "HK08_1000036946_2023_0700162451",
"supplierCode": "1000036946",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"companyCode": "HK08",
"currencyId": 1,
"description": "Debit Memo",
"amount": 39912,
"entryDate": "2023-05-17T00:00:00Z",
"issueDate": "2023-05-10T00:00:00Z",
"dueDate": "2023-08-08T00:00:00Z",
"payDate": "0001-01-01T00:00:00Z",
"baseLineDate": "2023-05-10T00:00:00Z",
"maturityDate": "2023-11-03T00:00:00Z",
"erpPostedDate": "0001-01-01T00:00:00Z",
"sellerOrganizationId": null,
"buyerOrganizationId": null,
"netAmount": 0,
"eccInvoiceNumber": "9953781495",
"fiscalYear": 2023,
"statusId": 1,
"subStatusId": 0,
"isActive": true,
"adjustedAmount": 0,
"isAdjusted": false,
"amountLeftForAdjustment": 39912,
"discountDate": "0001-01-01T00:00:00Z",
"originalDueDate": "0001-01-01T00:00:00Z",
"financingBankBranchId": "00000000-0000-0000-0000-000000000000",
"businessEntityId": "00000000-0000-0000-0000-000000000000",
"bankReference1": null,
"financeTenor": 129,
"supplierEntity": "",
"isDeleted": false,
"deleterId": null,
"deletionTime": null,
"lastModificationTime": null,
"lastModifierId": null,
"creationTime": "2023-05-17T19:05:27.397122Z",
"creatorId": "39fef723-0723-21e3-2564-1aee5a886074",
"id": "3a0b3d47-325c-15b0-a702-907606d81e42"
},
{
"tenantId": "d1be844b-d3a2-031a-f036-39f5d4380239",
"invoiceNumber": "8212395853",
"invoiceAdditionalReference": "0700162449",
"invoiceUniqueId": "HK08_1000036946_2023_0700162449",
"supplierCode": "1000036946",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"companyCode": "HK08",
"currencyId": 1,
"description": "Debit Memo",
"amount": 39912,
"entryDate": "2023-05-17T00:00:00Z",
"issueDate": "2023-05-10T00:00:00Z",
"dueDate": "2023-08-08T00:00:00Z",
"payDate": "0001-01-01T00:00:00Z",
"baseLineDate": "2023-05-10T00:00:00Z",
"maturityDate": "2023-11-03T00:00:00Z",
"erpPostedDate": "0001-01-01T00:00:00Z",
"sellerOrganizationId": null,
"buyerOrganizationId": null,
"netAmount": 0,
"eccInvoiceNumber": "9953781494",
"fiscalYear": 2023,
"statusId": 1,
"subStatusId": 0,
"isActive": true,
"adjustedAmount": 0,
"isAdjusted": false,
"amountLeftForAdjustment": 39912,
"discountDate": "0001-01-01T00:00:00Z",
"originalDueDate": "0001-01-01T00:00:00Z",
"financingBankBranchId": "00000000-0000-0000-0000-000000000000",
"businessEntityId": "00000000-0000-0000-0000-000000000000",
"bankReference1": null,
"financeTenor": 129,
"supplierEntity": "",
"isDeleted": false,
"deleterId": null,
"deletionTime": null,
"lastModificationTime": null,
"lastModifierId": null,
"creationTime": "2023-05-17T19:05:27.872368Z",
"creatorId": "39fef723-0723-21e3-2564-1aee5a886074",
"id": "3a0b3d47-3438-04c2-0395-ef2c7e309305"
},
{
"tenantId": "d1be844b-d3a2-031a-f036-39f5d4380239",
"invoiceNumber": "8212395855",
"invoiceAdditionalReference": "0700162452",
"invoiceUniqueId": "HK08_1000036946_2023_0700162452",
"supplierCode": "1000036946",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"companyCode": "HK08",
"currencyId": 1,
"description": "Debit Memo",
"amount": 79823.99,
"entryDate": "2023-05-17T00:00:00Z",
"issueDate": "2023-05-10T00:00:00Z",
"dueDate": "2023-08-08T00:00:00Z",
"payDate": "0001-01-01T00:00:00Z",
"baseLineDate": "2023-05-10T00:00:00Z",
"maturityDate": "2023-11-03T00:00:00Z",
"erpPostedDate": "0001-01-01T00:00:00Z",
"sellerOrganizationId": null,
"buyerOrganizationId": null,
"netAmount": 0,
"eccInvoiceNumber": "9953781496",
"fiscalYear": 2023,
"statusId": 1,
"subStatusId": 0,
"isActive": true,
"adjustedAmount": 0,
"isAdjusted": false,
"amountLeftForAdjustment": 79823.99,
"discountDate": "0001-01-01T00:00:00Z",
"originalDueDate": "0001-01-01T00:00:00Z",
"financingBankBranchId": "00000000-0000-0000-0000-000000000000",
"businessEntityId": "00000000-0000-0000-0000-000000000000",
"bankReference1": null,
"financeTenor": 129,
"supplierEntity": "",
"isDeleted": false,
"deleterId": null,
"deletionTime": null,
"lastModificationTime": null,
"lastModifierId": null,
"creationTime": "2023-05-17T19:05:34.917995Z",
"creatorId": "39fef723-0723-21e3-2564-1aee5a886074",
"id": "3a0b3d47-4fbd-2a6e-63df-b0982c6ca342"
},
{
"tenantId": "d1be844b-d3a2-031a-f036-39f5d4380239",
"invoiceNumber": "8212390700",
"invoiceAdditionalReference": "0700152368",
"invoiceUniqueId": "HK08_1000036946_2023_0700152368",
"supplierCode": "1000036946",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"companyCode": "HK08",
"currencyId": 1,
"description": "Debit Memo",
"amount": 239471.97,
"entryDate": "2023-05-16T00:00:00Z",
"issueDate": "2023-05-09T00:00:00Z",
"dueDate": "2023-08-07T00:00:00Z",
"payDate": "0001-01-01T00:00:00Z",
"baseLineDate": "2023-05-09T00:00:00Z",
"maturityDate": "2023-11-03T00:00:00Z",
"erpPostedDate": "0001-01-01T00:00:00Z",
"sellerOrganizationId": null,
"buyerOrganizationId": null,
"netAmount": 0,
"eccInvoiceNumber": "9953767426",
"fiscalYear": 2023,
"statusId": 1,
"subStatusId": 0,
"isActive": true,
"adjustedAmount": 0,
"isAdjusted": false,
"amountLeftForAdjustment": 239471.97,
"discountDate": "0001-01-01T00:00:00Z",
"originalDueDate": "0001-01-01T00:00:00Z",
"financingBankBranchId": "00000000-0000-0000-0000-000000000000",
"businessEntityId": "00000000-0000-0000-0000-000000000000",
"bankReference1": null,
"financeTenor": 129,
"supplierEntity": "",
"isDeleted": false,
"deleterId": null,
"deletionTime": null,
"lastModificationTime": null,
"lastModifierId": null,
"creationTime": "2023-05-16T19:09:32.69207Z",
"creatorId": "39fef723-0723-21e3-2564-1aee5a886074",
"id": "3a0b3824-948a-0366-7881-670d0f2cd185"
},
{
"tenantId": "d1be844b-d3a2-031a-f036-39f5d4380239",
"invoiceNumber": "8212384799",
"invoiceAdditionalReference": "0700146161",
"invoiceUniqueId": "HK08_1000036946_2023_0700146161",
"supplierCode": "1000036946",
"supplierId": "19a477b0-38e1-45ab-939b-b66812ea6105",
"companyCode": "HK08",
"currencyId": 1,
"description": "Debit Memo",
"amount": 79823.99,
"entryDate": "2023-05-15T00:00:00Z",
"issueDate": "2023-05-06T00:00:00Z",
"dueDate": "2023-08-06T00:00:00Z",
"payDate": "0001-01-01T00:00:00Z",
"baseLineDate": "2023-05-08T00:00:00Z",
"maturityDate": "2023-11-03T00:00:00Z",
"erpPostedDate": "0001-01-01T00:00:00Z",
"sellerOrganizationId": null,
"buyerOrganizationId": null,
"netAmount": 0,
"eccInvoiceNumber": "9953740370",
"fiscalYear": 2023,
"statusId": 1,
"subStatusId": 0,
"isActive": true,
"adjustedAmount": 0,
"isAdjusted": false,
"amountLeftForAdjustment": 79823.99,
"discountDate": "0001-01-01T00:00:00Z",
"originalDueDate": "0001-01-01T00:00:00Z",
"financingBankBranchId": "00000000-0000-0000-0000-000000000000",
"businessEntityId": "00000000-0000-0000-0000-000000000000",
"bankReference1": null,
"financeTenor": 129,
"supplierEntity": "",
"isDeleted": false,
"deleterId": null,
"deletionTime": null,
"lastModificationTime": null,
"lastModifierId": null,
"creationTime": "2023-05-15T19:07:53.971908Z",
"creatorId": "39fef723-0723-21e3-2564-1aee5a886074",
"id": "3a0b32fc-b6eb-9419-b543-aeaf3dd18c9b"
}
],
"creditNotesList": [],
"isCreatQuote": true,
"isCallFromAutoSubmissionJob": false
}
The job was for a tenant in the platform, how come this entry was stored in Host_Admin database and not in Tenant_Admin database ?
Few other questions
But it doesn't work post-deployment.
hi
Did you get any error logs? You can use
ILogger
to output some logs.
EnqueueAsync
will write a record to the database and return.
Hi, Thank you for your patience.
No there were no errors. Which table do we need to look for?
@gterdem
Our solution structure is bit different as compared to your microservice template. This application was create way before abp.io Micro service template came into picture. We connected with abp.io at times of creation of our application, it was created manually by guidance of abp.io support team only.
Can we please connect and have a look yourself as giving you sample source is not possible and we cannot provide you original source code as well.
Hi,
Could you please reply to this question ?
LitmusAppService
is not like any other app service
It is the custom base AppService
which Inherit from ApplicationService
And yes I am sure I am getting the same error.
Can you share the code?
LitmusAppService :
public abstract class LitmusAppService : ApplicationService
{
protected LitmusAppService()
{
LocalizationResource = typeof(LitmusResource);
}
}
CustomTenantAppService :
namespace SCV.Litmus.LitmusTenants
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(ITenantAppService), typeof(CustomTenantAppService))]
public class CustomTenantAppService : LitmusAppService, ITenantAppService
{
protected IEditionRepository EditionRepository { get; }
protected IDataSeeder DataSeeder { get; }
protected IDistributedEventBus DistributedEventBus { get; }
protected ITenantRepository TenantRepository { get; }
protected ITenantManager TenantManager { get; }
private readonly ISharedAppServices _sharedAppServices;
protected AbpDbConnectionOptions DbConnectionOptions { get; }
public CustomTenantAppService(
ITenantRepository tenantRepository,
IEditionRepository editionRepository,
ITenantManager tenantManager,
IDataSeeder dataSeeder,
IDistributedEventBus distributedEventBus,
IOptions<AbpDbConnectionOptions> dbConnectionOptions,
SCV.Litmus.SharedAppService.ISharedAppServices sharedAppServices)
{
EditionRepository = editionRepository;
DataSeeder = dataSeeder;
DistributedEventBus = distributedEventBus;
DbConnectionOptions = dbConnectionOptions.Value;
TenantRepository = tenantRepository;
TenantManager = tenantManager;
_sharedAppServices = sharedAppServices;
}
}
}
Error :
[11:54:00 ERR] [null] The requested service 'SCV.Litmus.LitmusTenants.CustomTenantAppService' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'SCV.Litmus.LitmusTenants.CustomTenantAppService' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)