public ProcessHandlerModule(ICommandDispatcher dispatcher, Func <IProcessManagerRepository> repositoryFactory, Func <Guid, string> buildId = null, string bucketId = null) { _dispatcher = dispatcher; _repositoryFactory = repositoryFactory; _buildId = buildId ?? (correlationId => typeof(TProcess).Name + "-" + correlationId); _bucketId = bucketId; _inner = new HandlerModule(); var generator = new DeterministicGuidGenerator(Guid.Parse(NAMESPACE)); _buildCommitId = (commitId, processId) => generator.Create(commitId + "-" + processId); }
internal static Task <bool> StartServer(NEEOConf conf) { if (conf == null || conf.Brain == null || conf.Name == null || conf.Devices == null) { throw new NEEOException("INVALID_STARTSERVER_PARAMETER"); } string adapterName = GenerateAdapterName(conf); var devicesDatabase = BuildDevicesDatabase(conf, adapterName); var requestHandler = HandlerModule.Build(devicesDatabase); _requestHandler = new HttpRequestHandler(requestHandler); conf.BaseUrl = conf.BaseUrl ?? GenerateBaseUrl(conf); return(StartSdkAndRetryIfConnectionFailed(conf, adapterName, requestHandler)); }
public TransientExceptionHandling() { var handlerModule = new HandlerModule(); // 1. Explicitly defining a retry policy in a handler handlerModule .For <Event>() .Handle((message, ct) => { return(Policy.Handle <Exception>() .RetryForeverAsync(ex => { /* log message */ }) .ExecuteAsync(() => /* some async op */ Task.FromResult(0))); }); // 2. Re-using a policy via extension methods. handlerModule .For <Event>() .ConnectionTimeoutRetry() .Handle((message, ct) => Task.FromResult(0)); }
public QueryHandlerModule() { _inner = new HandlerModule(); _registeredTypes = new Collection <Type>(); }
public CommandHandlerModule() { _registeredTypes = new HashSet <Type>(); _inner = new HandlerModule(); }
public Trainer() { ModuleHandler = new HandlerModule(this); new HandlerEvents(this); }