Skip to content

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

Open
@PingXD

Description

@PingXD

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions