Esempio n. 1
0
        private IBaseMessage CreateMessage(Shared.Components.Entry message)
        {
            MemoryStream mem = new MemoryStream(UTF8Encoding.UTF8.GetBytes(message.Content));

            IBaseMessageFactory factory = this.transportProxy.GetMessageFactory();
            IBaseMessagePart    part    = factory.CreateMessagePart();

            part.Data = mem;

            IBaseMessage msg = factory.CreateMessage();

            msg.AddPart("body", part, true);

            //  We must add these context properties
            SystemMessageContext context = new SystemMessageContext(msg.Context);

            context.InboundTransportLocation = this.uri;
            context.InboundTransportType     = this.transportType;
            //Set ActionOnFailure to zero in the context property of each messaqe that you do not want BizTalk Server to suspend on a processing exception.
            //Failure to set this property allows BizTalk Server to fall back to its default behavior
            //of suspending the message on a processing exception.
            //context.ActionOnFailure = 0;

            //we could promote entity id and updated, msg.Context.Promote(ns, message.Id
            return(msg);
        }
        private IBaseMessage CreateMessage(Shared.Components.Entry message)
        {
            MemoryStream mem = new MemoryStream(UTF8Encoding.UTF8.GetBytes(message.Content));

            IBaseMessageFactory factory = this.transportProxy.GetMessageFactory();
            IBaseMessagePart    part    = factory.CreateMessagePart();

            part.Data = mem;

            IBaseMessage msg = factory.CreateMessage();

            msg.AddPart("body", part, true);

            //  We must add these context properties
            SystemMessageContext context = new SystemMessageContext(msg.Context);

            context.InboundTransportLocation = this.uri;
            context.InboundTransportType     = this.transportType;

            //we could promote entity id and updated, msg.Context.Promote(ns, message.Id
            return(msg);
        }
        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);
        }