Sophos.Commands 1.5.8

Commands Library, for coordination of synchronous and asynchronous actions

Commands simplifies coordination of asynchronous and synchronous activities. It works with both task and non-task-based operations. The library is built upon class Command, which represents an action. A Command may be run synchronously or asynchronously, and may be aborted.

ParallelCommands, itself a Command, executes a collection of commands concurrently, and SequentialCommands executes its commands in sequence. Using these classes, it's possible to compose deep levels of coordinated actions. For example, SequentialCommands can hold instances of ParallelCommands, which in turn could hold SequentialCommands, and any other Command-derived object.

PeriodicCommand repeats its action at a given interval, ScheduledCommand runs once at a specific time, and RecurringCommand runs at times that are provided via a callback.

RetryableCommand offers the option to keep retrying a failed command until the caller has had enough, and TimeLimitedCommand fails with a timeout exception if a given duration elapses before the command finishes execution.

All of the above Command classes are simply containers for other Command objects that presumably do something of interest. They can be combined in ways that offer a lot of customization. For example, to make an HttpRequest at a given time, with a timeout and a configurable number of retries, you could create a ScheduledCommand containing a RetryableCommand containing a TimeLimitedCommand containing an HttpRequestCommand.

TaskCommand, DelegateCommand and Command.AsTask() offer easy integration with tasks and delegates.

CommandDispatcher manages asynchronous execution of dynamically generated commands.

The Command class allows registration of ICommandMonitor objects. CommandTracer will write diagnostic output to the debug stream, and CommandLogger will write diagnostic output to file. Using the provided CommandLogViewer app (source available in GitHub), it is possible to see the status of all command executions, including their parent/child relationships.

Guidelines for developing your own Command-derived class:

     - If the implementation of your command is naturally synchronous, inherit from SyncCommand

     - If the implementation of your command is naturally asynchronous and makes use of tasks (i.e. the Task class), inherit from TaskCommand

     - If the implementation of your command is naturally asynchronous but does not make use of tasks, inherit from AsyncCommand

     - Make your implementation responsive to abort requests if it could take more than a trivial amount of time. To do this, make ocassional calls to Command.CheckAbortFlag() or Command.AbortRequested

Versions for C++ and Java exist at https://github.com/efieleke/CommandLibForCPP.git and https://github.com/efieleke/CommandLibForJava.git.

A help file containing complete documentation exists within this package's contents.

Install-Package Sophos.Commands -Version 1.5.8
dotnet add package Sophos.Commands --version 1.5.8
<PackageReference Include="Sophos.Commands" Version="1.5.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sophos.Commands --version 1.5.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

  • .NETCoreApp 2.0

    • No dependencies.
  • .NETCoreApp 2.1

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.5.1

    • No dependencies.
  • .NETFramework 4.5.2

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.7.1

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

Version History

Version Downloads Last updated
1.5.8 101 1/2/2019