Giter VIP home page Giter VIP logo

Comments (7)

ajdwfnhaps avatar ajdwfnhaps commented on August 23, 2024

Thanks, Does it mean had fixed this bug at the latest nuget package version:2.1.1-preview-28414190 ?

from cap.

yang-xiaodong avatar yang-xiaodong commented on August 23, 2024

@ajdwfnhaps Yes, you can do a test !

from cap.

yang-xiaodong avatar yang-xiaodong commented on August 23, 2024

Version 2.1.1 has been released and fixed this bug.

from cap.

ajdwfnhaps avatar ajdwfnhaps commented on August 23, 2024

Got it. Great

from cap.

ajdwfnhaps avatar ajdwfnhaps commented on August 23, 2024

使用v2.1.1,现在没有在循环里,但异步发送MQ消息,偶尔还会报错

//遇到结束时,发送消息通知Quartz 动态启动用户汇总统计Job操作,并退出
            if (msg.eof == 1)
            {
                await _capBus.PublishAsync(MqOptions.AccountPeriodMacDetailEOFRouteKey, msg);
                return;
            }

[2017-11-30 10:50:00.7802] [] [WARN ] [DotNetCore.CAP.SubscribeQueueExecutor]:
Job failed to execute. Will retry.
System.InvalidOperationException: There is already an open DataReader associated with this Connection which must be closed first.
at MySqlConnector.Core.ServerSession.StartQuerying(MySqlCommand command) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 115
at MySqlConnector.Core.TextCommandExecutor.d__3.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\TextCommandExecutor.cs:line 66
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MySqlConnector.Core.TextCommandExecutor.d__1.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\TextCommandExecutor.cs:line 25
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MySql.Data.MySqlClient.MySqlTransaction.d__2.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlTransaction.cs:line 27
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MySql.Data.MySqlClient.MySqlTransaction.Commit() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlTransaction.cs:line 13
at DotNetCore.CAP.Abstractions.CapPublisherBase.ClosedCap() in D:\Work\aimei_finance\trunk\code\aimei_finance\CAP\DotNetCore.CAP\Abstractions\CapPublisherBase.cs:line 162
at DotNetCore.CAP.Abstractions.CapPublisherBase.d__35.MoveNext() in D:\Work\aimei_finance\trunk\code\aimei_finance\CAP\DotNetCore.CAP\Abstractions\CapPublisherBase.cs:line 137
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at AAM.Finance.Service.CAP.AccPeriodService.d__4.MoveNext() in D:\Work\aimei_finance\trunk\code\aimei_finance\CAP.Instance\AAM.Finance.Service\CAP\AccPeriodService.cs:line 48
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult() in D:\Work\aimei_finance\trunk\code\aimei_finance\CAP\DotNetCore.CAP\Internal\ObjectMethodExecutor\ObjectMethodExecutorAwaitable.cs:line 90
at DotNetCore.CAP.Internal.DefaultConsumerInvoker.d__7.MoveNext() in D:\Work\aimei_finance\trunk\code\aimei_finance\CAP\DotNetCore.CAP\Internal\IConsumerInvoker.Default.cs:line 72
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at DotNetCore.CAP.Internal.DefaultConsumerInvoker.<InvokeAsync>d__5.MoveNext() in D:\Work\aimei_finance\trunk\code\aimei_finance\CAP\DotNetCore.CAP\Internal\IConsumerInvoker.Default.cs:line 47 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at DotNetCore.CAP.Internal.DefaultSubscriberExecutor.d__7.MoveNext() in D:\Work\aimei_finance\trunk\code\aimei_finance\CAP\DotNetCore.CAP\Internal\ISubscriberExecutor.Default.cs:line 42

from cap.

yang-xiaodong avatar yang-xiaodong commented on August 23, 2024

@ajdwfnhaps 你这个可能是由于DI生命周期的问题,改成这样试一下

public class AccountPeriodJob : JobBase
{
    private readonly ILogger _logger;
    private readonly IServiceProvider _serviceProvider;

    public AccountPeriodJob(ILogger<AccountPeriodJob> logger, IServiceProvider serviceProvider)
    {
        _logger = logger;
        _serviceProvider = serviceProvider;
    }

    protected override async Task Invoke(IJobExecutionContext context)
    {
        using (var scope = _serviceProvider.CreateScope())
        {
            var provider = scope.ServiceProvider;
            var accountPeriodService = provider.GetRequiredService<IAccountPeriodService>();
            await accountPeriodService.SendAccountPeriodMQMessageAsync();
        }
        _logger.LogInformation("AccountPeriodJob Runing...");
    }
}

from cap.

ajdwfnhaps avatar ajdwfnhaps commented on August 23, 2024

谢谢你的建议,我按照你提供的方法试了一下,问题仍然存在,但如果我换成同步发送(_capBus.Publish),就不会出现这个问题

from cap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.