C# Class MSA.Zmq.JsonRpc.Worker

Inheritance: JsonRpcZmqBase
显示文件 Open project: kadekcipta/ZmqJsonRpc

Public Methods

Method Description
AddRequestProcessor ( IRequestProcessor processor ) : void

Add the pre-processor for request, for example the authentication processor

AddTaskHandler ( TaskHandlerDescriptor taskHandlerDescriptor ) : void
AddTaskHandler ( object taskHandlerDescriptorInstance, string endpointPrefix ) : void
BeginSuspend ( ) : void
Create ( string address, uint servicePort, ZmqContext context = null ) : Worker
Create ( string address, uint servicePort, string workerId, ZmqContext context = null ) : Worker
EndSuspend ( ) : void
GetAvailableTasks ( ) : IList
RemoveAllResolvers ( ) : void
SetMethodCallAuthorizer ( IMethodCallAuthorizer methodCallAuthorizer ) : void
SetMethodCallLogger ( IMethodCallLogger methodCallLogger ) : void
Start ( ) : void

Loop threads for publisher and replyer

Private Methods

Method Description
AuthorizeMethod ( JsonRpcRequestHeader requestHeader, JsonRpcRequest request, string requiredRoles ) : void
LogMethodCall ( JsonRpcRequestHeader requestHeader, JsonRpcRequest request ) : void

Logs method invocation

OnStarted ( ) : void

Dispatcher for started event

OnStopped ( ) : void

Dispatcher for stopped event

PreprocessRequest ( JsonRpcRequestHeader requestHeader, JsonRpcRequest request ) : void

Any preprocessing could be handled here. E.g decrypt, unzipped etc

ProcessRequest ( JsonRpcRequestHeader requestHeader, string requestJson ) : string

Process the request and all the responses (including errors) will be wrapped in json response The resolver will perform necessary checking against the request based on custom method attributes being requested and request information

StartHandleRequest ( uint port ) : void

Need framing here to separate the JSON data and the command/instruction | COMMAND | HEADER | JSON DATA |

ValidateRequest ( JsonRpcRequest request ) : void
Worker ( string address, uint servicePort, string workerId, ZmqContext context = null ) : System

Method Details

AddRequestProcessor() public method

Add the pre-processor for request, for example the authentication processor
public AddRequestProcessor ( IRequestProcessor processor ) : void
processor IRequestProcessor
return void

AddTaskHandler() public method

public AddTaskHandler ( TaskHandlerDescriptor taskHandlerDescriptor ) : void
taskHandlerDescriptor TaskHandlerDescriptor
return void

AddTaskHandler() public method

public AddTaskHandler ( object taskHandlerDescriptorInstance, string endpointPrefix ) : void
taskHandlerDescriptorInstance object
endpointPrefix string
return void

BeginSuspend() public method

public BeginSuspend ( ) : void
return void

Create() public static method

public static Create ( string address, uint servicePort, ZmqContext context = null ) : Worker
address string
servicePort uint
context ZmqContext
return Worker

Create() public static method

public static Create ( string address, uint servicePort, string workerId, ZmqContext context = null ) : Worker
address string
servicePort uint
workerId string
context ZmqContext
return Worker

EndSuspend() public method

public EndSuspend ( ) : void
return void

GetAvailableTasks() public method

public GetAvailableTasks ( ) : IList
return IList

RemoveAllResolvers() public method

public RemoveAllResolvers ( ) : void
return void

SetMethodCallAuthorizer() public method

public SetMethodCallAuthorizer ( IMethodCallAuthorizer methodCallAuthorizer ) : void
methodCallAuthorizer IMethodCallAuthorizer
return void

SetMethodCallLogger() public method

public SetMethodCallLogger ( IMethodCallLogger methodCallLogger ) : void
methodCallLogger IMethodCallLogger
return void

Start() public method

Loop threads for publisher and replyer
public Start ( ) : void
return void