示例#1
0
        public ExternalTaskWorker <TPayload, TResult> SubscribeToExternalTasksWithTopic <TPayload, TResult>(
            string topic,
            int maxTasks,
            int timeout,
            HandleExternalTaskAction <TPayload, TResult> handleAction
            )
            where TPayload : new()
            where TResult : new()
        {
            var externalTaskWorker = new ExternalTaskWorker <TPayload, TResult>(this.processEngineUrl, this.Identity, topic, maxTasks, timeout, handleAction);

            externalTaskWorker.Start();

            return(externalTaskWorker);
        }
        public async void HandleExternalTask()
        {
            var identity = new TestIdentity();
            var client   = new HttpClient();
            var url      = "http://localhost:8000";

            testObject = new ExternalTaskWorker <TestPayload, SampleResult>(
                url,
                identity,
                "TestTopic",
                10,
                10000,
                async(externalTask) =>
            {
                return(await this.Callback(externalTask));
            });

            testObject.Start();
        }