Пример #1
0
        private void ProcessRequest(string uri, HttpContext context, HttpReceiveEndpoint ep)
        {
            // Create a new message...
            IBaseMessage msg = ConstructMessage(uri, context, ep);

            // Submit the message using the StandardReceiveBatchHandler
            SyncReceiveSubmitBatch batch = new SyncReceiveSubmitBatch(transportProxy, terminator, 1);

            // Do one-way-submit
            batch.SubmitMessage(msg, null);
            batch.Done();

            if (!batch.Wait())
            {
                Trace.WriteLine("HttpReceiveAdapter.ProcessRequest(): Failed to process the Http Request!", "HttpReceive: Error");
                throw new HttpException(400, "Failed to process the Http Request");
            }

            context.Response.StatusCode = 202;
        }
Пример #2
0
        internal void SubmitFiles(ControlledTermination control, IList <string> filesInProcess)
        {
            if (Files == null || Files.Count == 0)
            {
                return;
            }

            _filesInProcess = filesInProcess;

            try
            {
                using (SyncReceiveSubmitBatch batch = new SyncReceiveSubmitBatch(_transportProxy, control, Files.Count))
                {
                    foreach (BatchMessage file in Files)
                    {
                        batch.SubmitMessage(file.Message, file.UserData);
                    }
                    batch.Done();

                    TraceMessage("[SftpReceiverEndpoint] SubmitFiles (firstAttempt) about to wait on BatchComplete");
                    if (batch.Wait())
                    {
                        TraceMessage("[SftpReceiverEndpoint] SubmitFiles (firstAttempt) overall success");
                        OnBatchComplete(this, new StatusEventArgs {
                            OverallStatus = true
                        });
                    }
                }
                TraceMessage("[SftpReceiverEndpoint] Leaving SubmitFiles");
            }
            catch (Exception ex)
            {
                throw ExceptionHandling.HandleComponentException(
                          EventLogEventIDs.UnableToSubmitBizTalkMessage,
                          System.Reflection.MethodBase.GetCurrentMethod(), ex);
            }
        }
        private bool SubmitMessage(BrokeredMessage message)
        {
            try
            {
                SyncReceiveSubmitBatch batch = new SyncReceiveSubmitBatch(this.transportProxy, this.control, 1);

                batch.SubmitMessage(CreateMessage(message));

                batch.Done();

                if (batch.Wait() == true)
                {
                    message.Complete();
                }

                return(batch.OverallSuccess);
            }
            catch (Exception e)
            {
                this.transportProxy.SetErrorInfo(e);
            }

            return(false);
        }
        private bool SubmitMessage(Shared.Components.Entry message)
        {
            try
            {
                SyncReceiveSubmitBatch batch = new SyncReceiveSubmitBatch(this.transportProxy, this.control, 1);

                batch.SubmitMessage(CreateMessage(message));

                batch.Done();

                if (batch.Wait() == true)
                {
                    atomState.LastEntryId = message.Id;
                }

                return(batch.OverallSuccess);
            }
            catch (Exception e)
            {
                this.transportProxy.SetErrorInfo(e);
            }

            return(false);
        }