예제 #1
0
        static void Main(string[] args)
        {
            Console.ReadKey();

            var request = new DipsTransportRequest {
                Id = Guid.NewGuid(), Message = "Process Dips Files Transfer"
            };
            var client = new RESTClient();

            Console.WriteLine("Sending Request = {0}", request.ToJson());

            var response = client
                           .TryPost <DipsTransportRequest, DipsTransportResponse>("http://localhost:61822/dipstransport/post", request)
                           .Result;

            Console.WriteLine("Response Received = {0}", response.ToJson());
            Console.ReadKey();
        }
        public DipsTransportResponse Post(DipsTransportRequest request)
        {
            Logger.Info(string.Format("Request Received, Client Process Id = {0}, Data = {1}", request.Id, request.ToJson()));

            var thread = new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                TransportProcessor.Process(request.Id);
            }
                                    );

            thread.Start();

            Logger.Info(string.Format("Returning Response, Client Process Id = {0}", request.Id));

            return(new DipsTransportResponse {
                Id = request.Id
            });
        }
예제 #3
0
        public void Execute(IJobExecutionContext context)
        {
            var name = context.JobDetail.JobDataMap.Get(JobDataMapKeys.Name);

            Logger.Info(string.Format("Job : {0} : {1} : {2} : Executing", this.GetType().Name, name, Id));

            foreach (var ep in CustomConfig.Instance.EndPoints)
            {
                var endPoint = ep;
                var request  = new DipsTransportRequest {
                    Id = this.Id, Message = "Process Dips Files Transfer"
                };

                var thread = new Thread(() =>
                {
                    Logger.Info(string.Format("Job : {0} : {1} : {2} : Dispatching Request, EndPoint = {3}, Data = {4}", Id, this.GetType().Name, name, endPoint.Url, request.ToJson()));

                    Thread.CurrentThread.IsBackground = true;

                    var response = new RESTClient()
                                   .TryPost <DipsTransportRequest, DipsTransportResponse>(endPoint.Url, request)
                                   .Result;

                    Logger.Info(string.Format("Job : {0} : {1} : {2} : Response Received, EndPoint = {3}, Data = {4}", Id, this.GetType().Name, name, endPoint.Url, response.ToJson()));
                }
                                        );

                thread.Start();
            }

            Logger.Info(string.Format("Job : {0} : {1} : {2} : Completed", this.GetType().Name, name, Id));
        }