Show / Hide Table of Contents

    Commands and Command Palettes

    As we explain in the "How Petabridge.Cmd Works" section, all of the functionality supported by the pbm or IPbmClient client is entirely dependent on the list of commands made available by the Petabridge.Cmd.Host. Whenever a client connects to a host, it will download all available CommandPalette objects defined and currently registered on the host.

    Out of the Box Commands

    Out of the box Petabridge.Cmd.Host ships with a range of commands for working with the Akka.NET logging system, such as being able to perform a live tail of logs being written in real time and viewing a sliding window of previously recorded logs. These are all built directly into the Petabridge.Cmd.Host package and no action is required to expose them to any pbm or IPbmClient client who connects.

    In addition to the built-in commands, Petabridge.Cmd also supports the following as additional modules, which need to be installed separately via NuGet:

    Module Description
    Petabridge.Cmd.Remote Akka.Remote monitoring instrumentation.
    Petabridge.Cmd.Cluster Support for Akka.Cluster management commands and monitoring instrumentation.
    Petabridge.Cmd.Cluster.Sharding Akka.Cluster.Sharding monitoring instrumentation.
    Petabridge.Cmd.Remote.FailureInjection Akka.Remote failure injection for testing network disruption scenarios

    Loading Additional Command Palettes

    Petabridge.Cmd ships with an additional set of commands for managing Akka.Cluster applications, which are not loaded by default. After installing the Petabridge.Cmd.Cluster NuGet package into your host application, you an register the commands with the PetabridgeCmd plugin via the following syntax:

    using Akka.Actor;
    using Petabridge.Cmd.Cluster;
    
    namespace Petabridge.Cmd.Host.Cluster.Sample
    {
        public class Program
        {
            private static void Main(string[] args)
            {
                using (var a = ActorSystem.Create("webcrawler"))
                {
                    var cmd = PetabridgeCmd.Get(a);
                    cmd.RegisterCommandPalette(ClusterCommands.Instance);
                    cmd.Start();
                    a.WhenTerminated.Wait();
                }
            }
        }
    }
    

    The call to PetabridgeCmd.RegisterCommandPalette allows you to register a CommandPaletteHandler, which is just a CommandPalette plus Props for an actor who can process those commands. This loads the command palette into the Petabridge.Cmd.Host and defines the formula for starting the actors who will process the command themselves.

    Note

    PetabridgeCmd.RegisterCommandPalette must be called before PetabridgeCmd.Start(). You can't register new CommandPaletteHandler instances after the Petabridge.Cmd.Host has started.

    Back to top Generated by DocFX