Comments (7)
Thanks, Does it mean had fixed this bug at the latest nuget package version:2.1.1-preview-28414190 ?
from cap.
@ajdwfnhaps Yes, you can do a test !
from cap.
Version 2.1.1 has been released and fixed this bug.
from cap.
Got it. Great
from cap.
使用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.TaskAwaiter
1.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.
@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.
谢谢你的建议,我按照你提供的方法试了一下,问题仍然存在,但如果我换成同步发送(_capBus.Publish),就不会出现这个问题
from cap.
Related Issues (20)
- .NET Core 8 使用RabbitMQ 报No ip address could be resolved for【hostName】的问题 HOT 1
- Optimizing RabbitMQ Performance and Managing Multiple Instances in CAP HOT 2
- Feature Request: Per-Queue Configuration for BasicQos and ConsumerThreadCount HOT 3
- 消息持久化支持达梦数据库吗 HOT 1
- Is the message data structure compatible with older versions of 3.0? HOT 1
- Add new option for parallel publish send. HOT 2
- Add option for controlling reponse headers from OnSubscribeExecuted HOT 2
- NATS Connection Error after Restarting nats-server: Unable to Publish Messages HOT 5
- SQL Server replication readpast error! "You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels" HOT 3
- 一个进程内可以创建多个CAP吗? HOT 1
- NATS feature: add the possibility to disable dynamic consumer subject/topic creation through NatsCapOtpions HOT 2
- 一个程序进程会操作多个不同的业务数据库,参考#998创建多个发布者进行对应处理,消费者应该如何处理消息? HOT 1
- Feature Request: Add New Column in table Cap.published for relation to table every single data publish HOT 2
- Callback on IIS Idle state HOT 2
- Cap-dashboard empty using dynamic subscribers with Azure Service Bus HOT 1
- Feature Request:Subscribers can batch process messages HOT 1
- 现在cap支持dm8数据库吗? HOT 2
- I have already developed CAP to support the Dameng database. How can I submit it HOT 1
- Considering adding support for RocketMQ ? HOT 1
- Support for AWS Event Bridge
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cap.