Class PetabridgeCmd
The petabridge.cmd host. Register CommandPalette instances with this in order to expose new capabilities with petabridge.cmd clients.
Implements
Inherited Members
Namespace: Petabridge.Cmd.Host
Assembly: Petabridge.Cmd.Host.dll
Syntax
public sealed class PetabridgeCmd : IExtension
Remarks
Must call the Start() method in order to turn on the host.
Properties
BoundEndpoint
Declaration
public EndPoint BoundEndpoint { get; }
Property Value
| Type | Description |
|---|---|
| EndPoint |
IsBound
When true, indicates that the inbound listening socket is bound.
Declaration
public bool IsBound { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
You can locate the inbound endpoint via BoundEndpoint
Settings
Declaration
public PetabridgeCmdSettings Settings { get; }
Property Value
| Type | Description |
|---|---|
| PetabridgeCmdSettings |
Sys
Declaration
public ExtendedActorSystem Sys { get; }
Property Value
| Type | Description |
|---|---|
| ExtendedActorSystem |
Methods
Get(ActorSystem)
Retrieves the instance of the PetabridgeCmd plugin for a given ActorSystem.
Declaration
public static PetabridgeCmd Get(ActorSystem sys)
Parameters
| Type | Name | Description |
|---|---|---|
| ActorSystem | sys | The actor system that this petabridge.cmd host will run on. |
Returns
| Type | Description |
|---|---|
| PetabridgeCmd | A singleton instance of the petabridge.cmd host. |
RegisterCommandPalette(CommandPaletteHandler)
Registers a new set of commands defined inside a CommandPalette for execution with the petabridge.cmd host.
Declaration
public bool RegisterCommandPalette(CommandPaletteHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandPaletteHandler | handler | The palette handler |
Returns
| Type | Description |
|---|---|
| bool |
|
Start()
Turns on the petabridge.cmd host. Safe to call multiple times. Will only start the host once.
Declaration
public void Start()
Remarks
No more CommandPalettes can be added once this method is called!
StartLocalClient()
Starts a local IPbmClient that can be used to interact programmatically with this PetabridgeCmd instance.
This client can be used over and over again until IsAvailable is no longer true, which happens when
the IPbmClient is disposed or when the actors it depends upon are terminated, typically via ActorSystem
termination.
Declaration
public Task<IPbmClient> StartLocalClient()
Returns
| Type | Description |
|---|---|
| Task<IPbmClient> | A new in-process IPbmClient instance. |
StartLocalClient(CancellationToken)
Starts a local IPbmClient that can be used to interact programmatically with this PetabridgeCmd instance.
This client can be used over and over again until IsAvailable is no longer true, which happens when
the IPbmClient is disposed or when the actors it depends upon are terminated, typically via ActorSystem
termination.
Declaration
public Task<IPbmClient> StartLocalClient(CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token | A cancellation token |
Returns
| Type | Description |
|---|---|
| Task<IPbmClient> | A new in-process IPbmClient instance. |