问题标签 [automatonymous]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
832 浏览

autofac - 使用 autofac 注册 saga 存储库时需要实体框架的示例

masstransit 文档有 NHiberbate 的示例,是否有人有相同的示例,但使用实体框架 (SagaDbContextFactory,SagaDbContext) 而不是 NHibernate

0 投票
2 回答
2046 浏览

c# - MassTransit Saga 状态到实例状态映射

我是 MassTransit 的新手,我似乎无法弄清楚它如何将我在 saga (MassTransitStateMachine) 上定义的状态映射到相关 SagaStateMachineInstance 类的“State”属性。

例如,如果我有一个具有三种状态的状态机类:

我的状态机实例类有一个“状态”属性

MT 如何决定哪个 saga 状态是哪个整数?

似乎还有两个内置的 saga 状态,“Initial”和“Final”,所以这个例子有 5 个状态。状态到整数的映射是如何完成的?

0 投票
1 回答
881 浏览

c# - 实体框架和 MySQL 的 MassTransit 传奇持久性

我正在使用 MassTransit(使用 RabbitMQ)和 Automatonymous 开发一个传奇。我使用 EntityFramework 作为我的存储引擎和 MySQL 作为我的数据库。每次我尝试运行 saga 并将其状态存储在数据库中时,EF 和 MySQL 的组合都会引发异常。使用此示例应用程序并使用 MySQL 数据库的连接字符串可以重现该问题。抛出的确切异常是:

System.Data.SqlClient.SqlException (0x80131904):建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。(提供者:命名管道提供者,错误:40 - 无法打开与 SQL Server 的连接)---> Syste m.ComponentModel.Win32Exception (0x80004005):系统找不到在 System.Data.SqlClient.SqlInternalConnectionTds 指定的文件。 .ctor(DbConnectionPoolIdentity 身份,SqlConnectionString connectionOptions,SqlCredential 凭证,对象 providerInfo,String newPassword,SecureString newSecurePassword,布尔重定向用户实例,SqlConnectionString userConnectionOptions,SessionData reconnectSessionData,1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 次重试,DbConnectionOptions userOptions,DbConnectionInternal oldConnection,Db ConnectionInternal& connection) 在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource 1 retry, DbConnectionOptions use rOptions) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 重试,DbConnectionOptions userOptions) 在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource 1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1重试)在 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b__36(DbConnection t, DbConnectionInterceptionContext c) 在 System.Data.Entity.Infrastructure.Interception.InternalDispatcher 1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action2 操作的 System.Data.SqlClient.SqlConnection.Open() 处, TInterceptionContext 拦截上下文,动作3 executing, Action3 执行)在 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) 在 System.Data.Entity.SqlServer.SqlProviderServices.<>c__DisplayClass33.b__32() 在 System.Data.Entity.SqlServer .DefaultSqlExecutionStrategy.<>c__DisplayClass1.b__0() at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func 1 operation) at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation) at System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection sqlConnection, Action1 act) at System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action 1 act) at System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable1 commandTimeout, System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase 处的 DbConnection sqlConnection,String createDatabaseScript)(DbConnection 连接,可空1 commandTimeout, StoreItemCollection storeItemCollection) at System.Data.Entity.Core.Common.DbProviderServices.CreateDatabase(DbConnection connection, Nullable1 commandTimeout, StoreItemCollection storeItemCollection) 在 System.Data.Entity.Migrations.DbMigrator System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection 连接) 在 System.Data.Entity.Core.Objects.ObjectContext.CreateDatabase() .EnsureDatabaseExists(Action mustSucceedToKeepDatabase) 在 System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func 3 createMigrator, ObjectContext objectContext) at System.Data.Entity.Internal.InternalContext.CreateDatabase(ObjectContext objectContext, DatabaseExistenceState existenceState) at System.Data.Entity.Database.Create(DatabaseExistenceState existenceState) at System.Data.Entity.CreateDatabaseIfNotExists1.InitializeDatabase(TContext context) 在 System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) 在 System.Data .Entity.Internal.InternalContext.<>c__DisplayClassf 1.PerformAction 1.<CreateInitializationAction>b__e() at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() at System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c) at System.Data.Entity.Internal.RetryAction(TInput 输入) 在 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action 1 action) at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() at System.Data.Entity.Internal.LazyInternalContext.get_ObjectContext() at System.Data.Entity.Database.BeginTransaction(IsolationLevel isolationLevel) at MassTransit.EntityFrameworkIntegration.Saga.EntityFrameworkSagaRepository1.d__81.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MassTransit.Saga.Pipeline.Filters.QuerySagaFilter2.>-Send>d__6.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 MassTransit.Saga.Pipeline.Filters.QuerySagaFilter 的 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 2.<MassTransit-Pipeline-IFilter<MassTransit-ConsumeContext<TMessage>>-Send>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MassTransit.Saga.Pipeline.Filters.CorrelationIdMessageFilter1.d__3.MoveNext() --- 从先前引发异常的位置结束堆栈跟踪---在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task任务)在 MassTransit.Pipeline.Filters.TeeConsumeFilter 的 System.Runtime.CompilerServices.TaskAwaiter.GetResult()1.<>c__DisplayClass7_0.<<Send>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MassTransit.Pipeline.Filters.TeeConsumeFilter1.d__7.MoveNext() --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task任务)在 MassTransit.Pipeline.Filters.MessageConsumeFilter 的 System.Runtime.CompilerServices.TaskAwaiter.GetResult()1.<MassTransit-Pipeline-IFilter<MassTransit-ConsumeContext>-Send>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at MassTransit.Pipeline.Filters.MessageConsumeFilter1.-Send>d__7.MoveNext() --- 在 System.Runtime.CompilerServices.TaskAwaiter 的 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 处从先前引发异常的位置结束堆栈跟踪。 HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MassTransit.Pipeline.Filters.DeserializeFilter.d__4.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪---在系统.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MassTransit.Pipeline.Filters.RescueReceiveContextFilter`1.-发送>d__5.MoveNext() ClientConnectionId:00000000-0000-0000-0000-000000000000 错误编号:2,状态:0,类别:20

如果我使用与 VS 2015 一起安装的本地数据库而不是 MySQL,那么它工作得非常好。它也适用于内存存储。即使异常说找不到服务器,我也可以确认它存在并且可以访问,因为示例应用程序在选择连接字符串时首先进行检查并且成功:

问题是否可能是因为它试图使用 SqlClient 访问 MySQL 数据库?

我正在使用 MySQL Server 5.7、EF 6.1.3、MassTransit 3.5.7 和 Automatonymous 3.5.11。

0 投票
0 回答
494 浏览

masstransit - 通过自然键关联的 Masstransit Saga 不起作用

我想使用唯一的自然键而不是在 Masstransit Sagas 中构建 Guid CorrelationId。但是,它似乎并没有真正起作用。如果我发送两次具有相同键值的初始事件,则在存储库中创建两个 Sagas - 预期是单个实例。使用 CorrelationId 的相同场景会在存储库中生成一个 Saga 实例。

任何想法,为什么第二个 Saga 实例使用相同的键创建,忽略相关性声明?

这是单元测试的简短示例:

0 投票
1 回答
915 浏览

masstransit - 在 Masstransit 状态机中使用 InMemoryOutbox,保留发布消息的顺序

我有一个使用 UseInMemoryOutbox() 配置的 MT 状态机,因此只有在管道中的最后一步成功完成后才会发布作为事件处理一部分的任何消息,在我的例子中,状态持久化到 Couchbase。

我注意到发布消息最终以不一致的顺序发布。

例如 - 假设第一个事件中的“SomeList”中有两个项目,因此消息有时按以下顺序发布:

而有时

等等。不保留逻辑流的顺序。

你能帮我解决这个问题吗?

我在用着

大众运输 3.5.2

MassTransit.Automatonymous 3.5.2

MassTransit.RabbitMQ 3.5.2

自动 3.5.11

绿管 1.0.9

谢谢,

0 投票
1 回答
451 浏览

masstransit - Masstransit State Machine - Retry Mechanism

In case a message is being "retried" as a result of an exception, is it being returned physically to the queue? to the beginning? to the end? Is it re-processed after the existed messages in queue? Is it being kept in application memory?

I have not found any description for the masstransit retry mechanism flow in the documentation.

Please refer me to any documentation that explains it, thanks.

0 投票
0 回答
283 浏览

entity-framework-core - 自动化和 EntityFrameworkCore 集成问题

当我使用 EntityFramework 保持状态时,出现如下错误

MT-原因: 故障

MT 故障消息: 找不到方法:'System.Threading.Tasks.Task`1 Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlCommandAsync(Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade,System.String,System.Threading.CancellationToken,System.Object [ ])'。

MT-Fault-StackTrace: 在 MassTransit.EntityFrameworkCoreIntegration.Saga.EntityFrameworkSagaRepository1.d__81.MoveNext() 在 System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) 在 MassTransit.EntityFrameworkCoreIntegration.Saga.EntityFrameworkSagaRepository1.SendQuery[T](SagaQueryConsumeContext2 上下文,ISagaPolicy2 策略, IPipe1 next) 在 MassTransit.Saga.Pipeline.Filters.QuerySagaFilter2.>-Send>d__6.MoveNext() 在 MassTransit.Saga.Pipeline.Filters.QuerySagaFilter2.-Send>d__6.MoveNext() 在 GreenPipes.Filters.TeeFilter1。 d__5.MoveNext() at GreenPipes.Filters.OutputPipeFilter2.d__6.MoveNext() at GreenPipes.Filters.OutputPipeFilter2.-Send>d__6.MoveNext() at MassTransit.Pipeline.Filters.DeserializeFilter.d__4.MoveNext() at GreenPipes.Filters .RescueFilter2.d__5.MoveNext()

我所有的测试都通过了,状态机正在使用InMemorySagaRepository. 但是当我将其更改为 时EntityFrameworkSagaRepository,很难存储并抛出错误。有什么建议么?

0 投票
0 回答
201 浏览

entity-framework - 无法从 Masstransit Saga 事件更新实体框架核心关系

我无法在我的 saga 实例事件中更新实体关系。

我可以为条目创建一对一的行,但是当我再次回到 IssueLocation 状态时,它没有检测到行已经存在并且引发错误

这是我的代码https://github.com/jaisopenoffice/IssueRequestStateMachine/tree/master

我需要更新 IssueLocation 而不是添加新记录(在 IssueTypeAccepted 事件中)。第一次它正在工作,但是当我再次回到相同的状态时,它正在尝试创建新记录。有正确的方法吗?

0 投票
0 回答
83 浏览

asp.net - 有没有办法用 Automatonymous 确认事件?

我想知道是否有办法用 Automatonymous 进行确认,如果前面的事件已经完成,我希望执行以下事件。

0 投票
1 回答
718 浏览

c# - Finalizing Saga on exception

I've created a saga and was wondering how to handle my exceptions during the execution of activities. Ideally, I would like to kill off that saga instance in some cases, immediately in the .Catch().

I've stumbled upon this thread: Understanding "Finalize" in MassTransit, my current approach is slightly different. In the .Catch() I publish a SagaFaultedEvent and transition to a Faulted state:

Then handle this event by logging the issue and finalizing the instance

This seems to work, however, in the answer to the mentioned thread, Chris says that the saga should be finalized directly there in the Catch(), however, there's no Finalize() available on the ExceptionActivityBinder and I don't have access to the EventActivityBinder there.

Am I missing something here (probably)? Is it possible to finalize the Saga directly in the Catch()?