将Akka.net群集闲话发送到Azure辅助角色控制台 [英] Sending Akka.net cluster gossip to Azure worker role console

查看:102
本文介绍了将Akka.net群集闲话发送到Azure辅助角色控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Azure云服务,其中包括构成akka.net群集的多个辅助角色.如何完成群集八卦和其他消息最终显示在计算仿真器控制台窗口中?

I'm developing an Azure cloud service including multiple worker roles that form an akka.net cluster. How do I accomplish getting the cluster gossip and other messages end up in the compute emulator console windows?

推荐答案

此刻,我正在Akka.NET群集上工作,该群集将作为Azure云服务托管,并遇到相同的问题.

At the moment I'm working on an Akka.NET cluster that will be hosted as Azure Cloud Services and ran into the same problem.

我发现完成此任务的最快方法是编写一个日志记录适配器(尽管我对Akka.NET还是比较陌生,所以请稍加盐渍地接受此建议).这是我现在正在使用的基本的:

The quickest way I found to accomplish this is to write a logging adapter (though I' still relatively new to Akka.NET, so take this advice with a pinch of salt). Here's the basic one I'm using for now:

public class ComputeEmulatorConsoleLogger : ReceiveActor
{
    public ComputeEmulatorConsoleLogger()
    {
        Receive<InitializeLogger>(_ =>
        {
            Trace.WriteLine("Compute emulator console logger started.");
            Sender.Tell(new LoggerInitialized());
        });

        Receive<LogEvent>(ev =>
        {
            Trace.WriteLine(ev.ToString());
        });
    }
}

然后在akka HOCON配置部分中添加类的路径和程序集名称,例如:

And in the akka HOCON configuration section add the class' path and assembly name, for example:

loggers = [ "WorkerRole2.ComputeEmulatorConsoleLogger,WorkerRole2" ]

这并不完美,但是正如您所看到的那样,它运作良好,因此您不必担心演员系统将要做什么而不必担心:

It's not perfect, but as you can see it works well enough so you're not pulling your hair out wondering what the actor system is up to:

这篇关于将Akka.net群集闲话发送到Azure辅助角色控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆