0

我正在开发一个在 AWS lambda 中托管 asp.net 核心应用程序的解决方案。这仅允许每个团队成员在开发期间拥有一个环境。它将在 docker 中运行以进行集成并上线。企业知识意味着它必须以这种方式运行。这是一个小型演员系统,必须按顺序一次运行一个作业。

问题是在本地时,一切正常,但是当托管在 AWS lambda 中时,从许多特定actorRef.Tell()调用开始的过程一直工作到第一次调用:Context.System.EventStream.Publish(). 没有警告或失败,它只是停止,直到 lambda 超时。似乎Context.System.EventStream.Subscribe(Self, typeof(SomeEvent));只是不起作用

我已经包含了大量的日志记录,所以我可以准确地看到它停止的位置。我还启用了所有 akka.net 日志记录:

"debug": {
    "autoreceive": "on",
    "eventStream": "on",
    "lifecycle": "on",
    "receive": "on",
    "unhandled": "on"
  }
  • 这与托管环境Context.System.EventStream.Publish()的影响有何不同?actorRef.Tell()
  • aws lambda 环境会导致这种行为吗?
  • 有没有办法配置 akka.net 来解决 aws lambda 中的任何约束?
  • 有没有人遇到过这类问题?

编辑

akka.net 依赖的任何方面都EventStream不起作用。甚至使用Context.GetLogger. 当我从基于上下文的记录器更改为注入时,演员才开始记录ILogger<T>

_logger.Info("Message {@msg} validated successfully, processing", e.MsgId); // this is shown in the logs also
Context.System.EventStream.Publish(new ProcessHl7MessageCommand(e.Body));

下面是 lambda 调用的生命周期,从 13:09:07 到 13:09:12 一切都是肉汁,然后发布的事件无处可去:

2021-03-08T13:09:07.017+00:00   START RequestId: a57732ba-4d37-46c1-b184-6f4c4b3dc438 Version: $LATEST
2021-03-08T13:09:07.019+00:00   13:09:06.996 [WARN] Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository - Using an in-memory repository. Keys will not be persisted to storage.
2021-03-08T13:09:07.155+00:00   13:09:07.000 [WARN] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager - Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
2021-03-08T13:09:07.182+00:00   13:09:07.152 [WARN] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager - No XML encryptor configured. Key {d261dd3f-bbc7-4ad4-a0a5-20cac3e43970} may be persisted to storage in unencrypted form.
2021-03-08T13:09:07.182+00:00   Akka config journal: akka.persistence.journal.sqlServer
2021-03-08T13:09:07.457+00:00   Akka config SnapshotStore: akka.persistence.snapshot-store.sqlServer
2021-03-08T13:09:07.457+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0001][EventStream] subscribing [akka://all-systems/] to channel Akka.Event.Debug
2021-03-08T13:09:07.457+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0001][EventStream] subscribing [akka://all-systems/] to channel Akka.Event.Info
2021-03-08T13:09:07.458+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0001][EventStream] subscribing [akka://all-systems/] to channel Akka.Event.Warning
2021-03-08T13:09:07.458+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0001][EventStream] subscribing [akka://all-systems/] to channel Akka.Event.Error
2021-03-08T13:09:07.538+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0001][EventStream] StandardOutLogger started
2021-03-08T13:09:07.555+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0012][akka://P80System/system] Started (Akka.Actor.SystemGuardianActor)
2021-03-08T13:09:07.555+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0001][EventStream] subscribing [akka://P80System/system/UnhandledMessageForwarder#274328165] to channel Akka.Event.UnhandledMessage
2021-03-08T13:09:07.555+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0001][EventStream(P80System)] StandardOutLogger being removed
2021-03-08T13:09:07.555+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0001][EventStream] unsubscribing [akka://all-systems/] from all channels
2021-03-08T13:09:07.555+00:00   [DEBUG][3/8/2021 1:09:07 PM][Thread 0014][akka://P80System/] Started (Akka.Actor.GuardianActor)
2021-03-08T13:09:12.616+00:00   END RequestId: a57732ba-4d37-46c1-b184-6f4c4b3dc438
2021-03-08T13:09:12.616+00:00   REPORT RequestId: a57732ba-4d37-46c1-b184-6f4c4b3dc438 Duration: 4995.25 ms Billed Duration: 4996 ms Memory Size: 1024 MB Max Memory Used: 249 MB Init Duration: 2362.63 ms
********
2021-03-08T13:10:03.196+00:00   START RequestId: 76e19c6d-3265-4ef0-abfe-82bf68f01bf4 Version: $LATEST
2021-03-08T13:10:03.216+00:00   13:10:03.216 [INFO] P80.Api.Controllers.MessagesController - Received 8142
2021-03-08T13:10:03.277+00:00   13:10:03.277 [INFO] P80.Ordering.Hl7MessageManagerActor - Initializing P80.Models.Messages.Commands.StartProcessingCommand
2021-03-08T13:10:03.278+00:00   13:10:03.278 [INFO] P80.Ordering.MessageLoaderActor - Loading Message 8142
2021-03-08T13:10:03.278+00:00   13:10:03.278 [INFO] P80.Ordering.MessageLoaderActor - Loading 8142
2021-03-08T13:10:03.741+00:00   13:10:03.740 [INFO] P80.Data.Context.MessageResourceAccess - Message loaded: { MsgId = 8142, CustomerName = A PHARMACY IN JURIEN BAY }
2021-03-08T13:10:03.798+00:00   13:10:03.798 [INFO] P80.Ordering.MessageLoaderActor - Message loaded: 8142
2021-03-08T13:10:03.860+00:00   13:10:03.859 [INFO] P80.Ordering.Hl7MessageManagerActor - Message 8142 validated successfully, processing
******* Here's where the first call to EventStream.Publish() occurs and nothing happens again until the lambda closes. 
2021-03-08T13:10:30.258+00:00   13:10:30.257 [INFO] P80.Api.Controllers.MessagesController - Message 8142 still processing after 00:00:27...
2021-03-08T13:10:30.262+00:00   END RequestId: 76e19c6d-3265-4ef0-abfe-82bf68f01bf4
2021-03-08T13:10:30.262+00:00   REPORT RequestId: 76e19c6d-3265-4ef0-abfe-82bf68f01bf4 Duration: 27063.17 ms Billed Duration: 27064 ms Memory Size: 1024 MB Max Memory Used: 285 MB
4

0 回答 0