Class MessagingCommandProcessor
Command processor based on messaging. It packs the command line in messages and delegates execution to the IMessageProcessor.
Inheritance
Implements
Inherited Members
Namespace: Kephas.Application.Console
Assembly: Kephas.Application.Console.dll
Syntax
[OverridePriority(Priority.Low)]
public class MessagingCommandProcessor : ICommandProcessor
Constructors
| Improve this Doc View SourceMessagingCommandProcessor(ICommandRegistry, ICommandIdentityResolver, IMessageProcessor, IContextFactory)
Initializes a new instance of the MessagingCommandProcessor class.
Declaration
public MessagingCommandProcessor(ICommandRegistry registry, ICommandIdentityResolver identityResolver, IMessageProcessor messageProcessor, IContextFactory contextFactory)
Parameters
Type | Name | Description |
---|---|---|
ICommandRegistry | registry | The registry. |
ICommandIdentityResolver | identityResolver | The identity resolver. |
IMessageProcessor | messageProcessor | The message processor. |
IContextFactory | contextFactory | The context factory. |
Methods
| Improve this Doc View SourceCreateMessage(String, IExpando)
Creates the message from the command and the arguments.
Declaration
protected virtual IMessage CreateMessage(string command, IExpando args)
Parameters
Type | Name | Description |
---|---|---|
System.String | command | The command. |
IExpando | args | The arguments. |
Returns
Type | Description |
---|---|
IMessage | The new message. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the requested operation is invalid. |
GetMessageArguments(IExpando)
Gets message arguments.
Declaration
protected virtual IDictionary<string, object> GetMessageArguments(IExpando args)
Parameters
Type | Name | Description |
---|---|---|
IExpando | args | The arguments. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | The message arguments. |
HandleUnknownArgument(IMessage, ITypeInfo, Int32, String, Object)
Handles an argument that cannot be matched by name.
Declaration
protected virtual bool HandleUnknownArgument(IMessage message, ITypeInfo messageType, int index, string name, object value)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | The message. |
ITypeInfo | messageType | Type of the message. |
System.Int32 | index | Zero-based index of the argument. |
System.String | name | The name. |
System.Object | value | The value. |
Returns
Type | Description |
---|---|
System.Boolean | True if it succeeds, false if it fails. |
ProcessAsync(String, IExpando, CancellationToken)
Executes the asynchronous operation.
Declaration
public Task<object> ProcessAsync(string command, IExpando args = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | command | The command. |
IExpando | args | Optional. The arguments. |
System.Threading.CancellationToken | cancellationToken | Optional. A token that allows processing to be cancelled. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | The asynchronous result. |
ProcessMessageAsync(IMessage, IExpando, CancellationToken)
Process the message asynchronously.
Declaration
protected virtual Task<object> ProcessMessageAsync(IMessage message, IExpando args, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | The message. |
IExpando | args | The arguments. |
System.Threading.CancellationToken | cancellationToken | A token that allows processing to be cancelled. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | An asynchronous result that yields the process message. |
SetPropertyValue(IMessage, IPropertyInfo, Object)
Sets the message property value.
Declaration
protected virtual void SetPropertyValue(IMessage message, IPropertyInfo propInfo, object value)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | The message. |
IPropertyInfo | propInfo | Information describing the property. |
System.Object | value | The value. |