Exemplo n.º 1
0
        /// <summary>
        /// Generate test messages in the inbound queue
        /// </summary>
        /// <param name="imagesFolderPath">The full path of the image folder</param>
        /// <returns></returns>
        private static RecogniseBatchCourtesyAmountRequest PopulateInboundQueue(
            string imagesFolderPath)
        {
            int j;
            var batchRequest = new RecogniseBatchCourtesyAmountRequest();
            var list = new List<RecogniseCourtesyAmountRequest>();

            batchRequest.jobIdentifier = Path.GetFileName(imagesFolderPath);
            //var fileCount = Directory.GetFiles(imagesFolderPath, "*.tif").GetLength(0);
            var fileEnum = Directory.GetFiles(imagesFolderPath, "*.tif");
            foreach (var filePath in fileEnum)
            {
                var fileName = Path.GetFileName(filePath);
                if (fileName != null)
                {
                    var pos1 = fileName.IndexOf('-');
                    //var pos2 = fileName.LastIndexOf('_');
                    var request = new RecogniseCourtesyAmountRequest()
                    {
                        documentReferenceNumber = fileName.Substring(pos1 + 1, 9),
                        processingDate = new DateTime(2015, 3, 30)
                    };
                    list.Add(request);

                }
            }
            //Console.WriteLine(string.Format("The {0}th message has {1} image files", i, j));

            batchRequest.voucher = list.ToArray();
            //rabbitService.PopulateInboundQueue(batchRequest, correlationId++.ToString());
            return batchRequest;
        }
        public void WhenAMessageWithJobIdentifierArrivesInQueueLombard_Service_Outclearings_Recognisecourtesyamount_Request_QueueForTheFollowingVouchers(string jobId, Table table)
        {
            var vouchers = table.CreateSet<RecogniseCourtesyAmountRequest>();
            var message = new RecogniseBatchCourtesyAmountRequest
            {
                jobIdentifier = jobId,
                voucher = vouchers.ToArray()
            };

            AutoReadCarBus.Publish(message);

            Thread.Sleep(3000);
        }
Exemplo n.º 3
0
        public static void Publish(RecogniseBatchCourtesyAmountRequest request)
        {
            Requests.Add(request);

            Task.WaitAll(InboundExchange.PublishAsync(request, null));
        }