Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]Does the BatchJobClient have a plan to support async methods? #2495

Open
PingXD opened this issue Jan 18, 2025 · 0 comments
Open

Comments

@PingXD
Copy link

PingXD commented Jan 18, 2025

Does the BatchJobClient have a plan to support async methods?

 _batchJobClient.StartNew(action =>
{
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());//some job
                    using TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew);
                    _warehouseDbContext.SaveChanges();
                    _commonDbContext.SaveChanges();
                    transactionScope.Complete();
});

I want to use async callback method

 _batchJobClient.StartNew(async action =>
{
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());
                    action.Enqueue<IHomeServicecs>(t => t.TestMethod());//some job
                    using TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew);
                    await     _warehouseDbContext.SaveChangesAsync();
                    await _commonDbContext.SaveChangesAsync();
                    transactionScope.Complete();
});

If there is no plan, is there any way I can adapt it myself? I looked at the source code and found that it didn't seem like that much work to change this method alone

@PingXD PingXD changed the title Does the BatchJobClient have a plan to support async methods? [Question]Does the BatchJobClient have a plan to support async methods? Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant