Example #1
0
 public Batch(IBTTransportProxy transportProxy, bool makeSuccessCall)
 {
     this.hrStatus        = -1;
     this.transportProxy  = transportProxy;
     this.transportBatch  = this.transportProxy.GetBatch(this, null);
     this.makeSuccessCall = makeSuccessCall;
 }
        public override void Open(string uri, Microsoft.BizTalk.Component.Interop.IPropertyBag config, IPropertyBag bizTalkConfig, Microsoft.BizTalk.Component.Interop.IPropertyBag handlerPropertyBag, IBTTransportProxy transportProxy, string transportType, string propertyNamespace, ControlledTermination control)
        {
            try
            {
                this.properties = new SBQueueReceiveProperties(uri);

                XmlDocument locationConfigDom = ConfigProperties.ExtractConfigDom(config);
                this.properties.LocationConfiguration(locationConfigDom, false);

                //  this is our handle back to the EPM
                this.transportProxy = transportProxy;

                //  used to control whether the EPM can unload us
                this.control = control;

                this.uri               = uri;
                this.transportType     = transportType;
                this.propertyNamespace = propertyNamespace;
                this.messageFactory    = this.transportProxy.GetMessageFactory();

                Start();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
            }
        }
Example #3
0
 public Batch(IBTTransportProxy transportProxy, bool makeSuccessCall)
 {
     _hrStatus        = -1;
     _transportProxy  = transportProxy;
     _transportBatch  = _transportProxy.GetBatch(this, null);
     _makeSuccessCall = makeSuccessCall;
 }
 public TxnBatch(IBTTransportProxy transportProxy, ControlledTermination control, IDtcTransaction comTxn, CommittableTransaction transaction, ManualResetEvent orderedEvent, bool makeSuccessCall) : base(transportProxy, makeSuccessCall)
 {
     this.control      = control;
     this.comTxn       = comTxn;
     this.transaction  = transaction;
     this.orderedEvent = orderedEvent;
 }
Example #5
0
 /// <summary>
 /// Terminate the adapter
 /// </summary>
 /// <remarks>
 /// Wait for all send operations to end,
 /// then release the transport proxy and terminate
 /// </remarks>
 public void Terminate()
 {
     _terminate.Leave();
     _terminate.Terminate();
     Marshal.ReleaseComObject(_tp);
     _tp = null;
 }
Example #6
0
 public ReceiveBatch(IBTTransportProxy transportProxy, ControlledTermination control, ManualResetEvent orderedEvent, int depth) : base(transportProxy, true)
 {
     this.control      = control;
     this.orderedEvent = orderedEvent;
     this.innerBatch   = null;
     this.depth        = depth;
 }
 private SyncReceiveSubmitBatch(IBTTransportProxy transportProxy, ControlledTermination control,
                                ManualResetEvent submitComplete, int depth)
     : base(transportProxy, control, submitComplete, depth)
 {
     this.control               = control;
     this.workDone              = submitComplete;
     base.ReceiveBatchComplete += new ReceiveBatchCompleteHandler(OnBatchComplete);
 }
Example #8
0
 private SyncReceiveSubmitBatch(IBTTransportProxy transportProxy, ControlledTermination control,
                                ManualResetEvent submitComplete, int depth)
     : base(transportProxy, control, submitComplete, depth)
 {
     _control              = control;
     _workDone             = submitComplete;
     ReceiveBatchComplete += OnBatchComplete;
 }
        public virtual void Terminate()
        {
            Trace.WriteLine("Adapter.Terminate");

            if (!this.initialized)
                throw new NotInitialized();

            this.transportProxy = null;
        }
Example #10
0
 internal BatchHandler(ISftp sftp, string propertyNamespace, string transportType, IBTTransportProxy transportProxy, bool traceFlag, bool useLoadBalancing)
 {
     _sftp = sftp;
     _propertyNamespace = propertyNamespace;
     _transportType     = transportType;
     _transportProxy    = transportProxy;
     _traceFlag         = traceFlag;
     _useLoadBalancing  = useLoadBalancing;
 }
        public AsyncTransmitterBatch(int maxBatchSize, Type endpointType, string propertyNamespace, IPropertyBag handlerPropertyBag, IBTTransportProxy transportProxy, AsyncTransmitter asyncTransmitter)
        {
            _maxBatchSize     = maxBatchSize;
            PropertyNamespace = propertyNamespace;
            _transportProxy   = transportProxy;
            _asyncTransmitter = asyncTransmitter;

            // this.worker = new WorkerDelegate(Worker);
        }
Example #12
0
 public HttpReceiveAdapter()
     : base(protocol, "1.0", description, protocol, clsid, null, typeof(HttpReceiveEndpoint))
 {
     // Since we are an Isolated Adapter, we need to create
     // this Adapters Transport Proxy and initialize it with
     // one of our urls...
     this.transportProxy = (IBTTransportProxy) new BTTransportProxy();
     base.Initialize(this.transportProxy);
 }
Example #13
0
        /// <summary>
        /// Initialize the adapter by taken the address of receive location from message context
        /// </summary>
        /// <param name="tp">Transport proxy object reference</param>
        /// <param name="message">BizTalk message object reference</param>
        /// <param name="callBack">Reference to the configuration callback interface</param>
        private void InternalInitialize(IBTTransportProxy tp, IBaseMessage message, IBTTransportConfig callBack)
        {
            IBaseMessageContext ctx;

            ctx = message.Context;
            SystemMessageContext smc = new SystemMessageContext(ctx);
            string url = smc.InboundTransportLocation;

            InternalInitialize(tp, url, callBack);
        }
Example #14
0
        /// <summary>
        /// Close the adapter
        /// </summary>
        public void Close()
        {
            if (null != _tp)
            {
                _tp.TerminateIsolatedReceiver();
            }

            _initialized = false;
            _tp          = null;
        }
Example #15
0
        public virtual void Terminate()
        {
            Trace.WriteLine("Adapter.Terminate");

            if (!this.initialized)
            {
                throw new NotInitialized();
            }

            this.transportProxy = null;
        }
Example #16
0
        public TxnBatch(IBTTransportProxy transportProxy, ControlledTermination control, CommittableTransaction transaction, ManualResetEvent orderedEvent, bool makeSuccessCall) : base(transportProxy, makeSuccessCall)
        {
            this.control = control;

            this.comTxn = TransactionInterop.GetDtcTransaction(transaction);

            //  the System.Transactions transaction - must be the original transaction - only that can be used to commit
            this.transaction = transaction;

            this.orderedEvent = orderedEvent;
        }
Example #17
0
        private ArrayList messageList;          //  the list of messages that BizTalk gives us to process

        public TransactionalAsyncBatch(IBTTransportProxy transportProxy, ControlledTermination control, string propertyNamespace, int maxBatchSize)
        {
            this.worker      = new WorkerDelegate(Worker);
            this.batchWorker = new BatchWorkerDelegate(BatchWorker);

            this.transportProxy    = transportProxy;
            this.control           = control;
            this.propertyNamespace = propertyNamespace;
            this.maxBatchSize      = maxBatchSize;
            this.messageList       = new ArrayList();
        }
        //  IBTransportControl
        public virtual void Initialize(IBTTransportProxy transportProxy)
        {
            Trace.WriteLine("Adapter.Initialize");

            //  this is a Singleton and this should only ever be called once
            if (this.initialized)
                throw new AlreadyInitialized();

            this.transportProxy = transportProxy;
            this.initialized = true;
        }
Example #19
0
        public ReceiveBatch(IBTTransportProxy transportProxy, ControlledTermination control, ReceiveBatchCompleteHandler callback, int depth) : base(transportProxy, true)
        {
            this.control = control;

            if (callback != null)
            {
                this.ReceiveBatchComplete += callback;
            }

            this.innerBatch = null;
            this.depth      = depth;
        }
Example #20
0
        /// <summary>
        /// Creatable receiver constructor
        /// </summary>
        /// <param name="tp">Transport proxy object reference</param>
        public BizTalkMessaging(IBTTransportProxy tp)
        {
            if (null == tp)
            {
                throw new ArgumentNullException("IBTTransportProxy may not be null");
            }

            this._tp = tp;
            _mf      = _tp.GetMessageFactory();

            _initialized = true;
        }
        //  IBTransportControl
        public virtual void Initialize(IBTTransportProxy transportProxy)
        {
            Trace.WriteLine("Adapter.Initialize");

            //  this is a Singleton and this should only ever be called once
            if (Initialized)
            {
                throw new AlreadyInitialized();
            }

            TransportProxy = transportProxy;
            Initialized    = true;
        }
        public AsyncTransmitterBatch(int maxBatchSize, Type endpointType, string propertyNamespace, IPropertyBag handlerPropertyBag, IBTTransportProxy transportProxy, AsyncTransmitter asyncTransmitter)
        {
            this.maxBatchSize = maxBatchSize;
            this.endpointType = endpointType;
            this.propertyNamespace = propertyNamespace;
            this.handlerPropertyBag = handlerPropertyBag;
            this.transportProxy = transportProxy;
            this.asyncTransmitter = asyncTransmitter;

            this.messages = new ArrayList();

            // this.worker = new WorkerDelegate(Worker);
        }
Example #23
0
        public AsyncTransmitterBatch(int maxBatchSize, Type endpointType, string propertyNamespace, IPropertyBag handlerPropertyBag, IBTTransportProxy transportProxy, AsyncTransmitter asyncTransmitter)
        {
            this.maxBatchSize       = maxBatchSize;
            this.endpointType       = endpointType;
            this.propertyNamespace  = propertyNamespace;
            this.handlerPropertyBag = handlerPropertyBag;
            this.transportProxy     = transportProxy;
            this.asyncTransmitter   = asyncTransmitter;

            this.messages = new ArrayList();

            // this.worker = new WorkerDelegate(Worker);
        }
        public override void Open(string uri, IPropertyBag config, IPropertyBag bizTalkConfig, IPropertyBag handlerPropertyBag, IBTTransportProxy transportProxy, string transportType, string propertyNamespace, ControlledTermination controlledTermination)
        {
            this.transportProxy        = transportProxy;
            this.transportType         = transportType;
            this.uri                   = uri;
            this.controlledTermination = controlledTermination;
            this.properties            = new ScheduledProperties();
            XmlDocument locationConfigDom = ConfigProperties.ExtractConfigDom(config);

            this.properties.LocationConfiguration(locationConfigDom);
            //  create and schedule a new the task
            this.taskController = new TaskController(new ScheduledTask(this.properties.Name, new ScheduledTask.TaskDelegate(this.ControlledEndpointTask)), this.properties.Schedule);
            this.taskController.StateChanged += new StateChangedEventHandler(this.OnStateChanged);
            this.taskController.Enabled       = true;
            this.taskController.Start();
        }
        /// <summary>
        /// This method is called when a Receive Location is enabled.
        /// </summary>
        public override void Open(
            string uri,
            IPropertyBag config,
            IPropertyBag bizTalkConfig,
            IPropertyBag handlerPropertyBag,
            IBTTransportProxy transportProxy,
            string transportType,
            string propertyNamespace,
            ControlledTermination control)
        {
            this._errorCount = 0;

            this._properties = new SftpReceiveProperties();
            _properties.LocationConfiguration(config, bizTalkConfig);

            //  Location properties - possibly override some Handler properties
            XmlDocument locationConfigDom = ConfigProperties.ExtractConfigDom(config);

            this._properties.ReadLocationConfiguration(locationConfigDom);

            //  this is our handle back to the EPM
            this._transportProxy = transportProxy;

            // used to create new messages / message parts etc.
            this._messageFactory = this._transportProxy.GetMessageFactory();

            //  used in the creation of messages
            this._transportType = transportType;

            //  used in the creation of messages
            this._propertyNamespace = propertyNamespace;

            // used to track inflight work for shutting down properly
            this._controlledTermination = control;

            //  create and schedule a new the task
            this._taskController = new TaskController(
                new ScheduledTask(this._properties.Uri,
                                  new ScheduledTask.TaskDelegate(this.ControlledEndpointTask)),
                this._properties.Schedule);

            this._taskController.StateChanged += new StateChangedEventHandler(this.OnStateChanged);

            // start the task
            Start();
        }
Example #26
0
        /// <summary>
        /// This method is called when a Receive Location is enabled.
        /// </summary>
        public void Open(
            string uri,
            IPropertyBag config,
            IPropertyBag bizTalkConfig,
            IPropertyBag handlerPropertyBag,
            IBTTransportProxy transportProxy,
            string transportType,
            string propertyNamespace,
            ControlledTermination control)
        {
            _errorCount = 0;

            _properties = new SftpReceiveProperties();
            _properties.LocationConfiguration(config, bizTalkConfig);

            //  Location properties - possibly override some Handler properties
            XmlDocument locationConfigDom = ConfigProperties.ExtractConfigDom(config);

            _properties.ReadLocationConfiguration(locationConfigDom);

            //  this is our handle back to the EPM
            _transportProxy = transportProxy;

            //  used in the creation of messages
            _transportType = transportType;

            //  used in the creation of messages
            _propertyNamespace = propertyNamespace;

            // used to track inflight work for shutting down properly
            _controlledTermination = control;

            //  create and schedule a new the task
            _taskController = new TaskController(
                new ScheduledTask(_properties.Uri,
                                  ControlledEndpointTask),
                _properties.Schedule);

            _taskController.StateChanged += OnStateChanged;

            // start the task
            Start();
        }
        protected Adapter(
            string name,
            string version,
            string description,
            string transportType,
            Guid clsid,
            string propertyNamespace)
        {
            Trace.WriteLine(String.Format("Adapter.Adapter name: {0}", name));

            this.transportProxy = null;
            this.handlerPropertyBag = null;
            this.initialized = false;

            this.name = name;
            this.version = version;
            this.description = description;
            this.transportType = transportType;
            this.clsid = clsid;

            this.propertyNamespace = propertyNamespace;
        }
Example #28
0
        protected Adapter(
            string name,
            string version,
            string description,
            string transportType,
            Guid clsid,
            string propertyNamespace)
        {
            Trace.WriteLine(String.Format("Adapter.Adapter name: {0}", name));

            this.transportProxy     = null;
            this.handlerPropertyBag = null;
            this.initialized        = false;

            this.name          = name;
            this.version       = version;
            this.description   = description;
            this.transportType = transportType;
            this.clsid         = clsid;

            this.propertyNamespace = propertyNamespace;
        }
Example #29
0
        /// <summary>
        /// Initialize the adapter by specifying the address of the receive location that uses the adapter
        /// </summary>
        /// <param name="tp">Transport proxy object reference</param>
        /// <param name="url">Address of the receive location</param>
        /// <param name="callBack">Reference to the configuration callback interface</param>
        private void InternalInitialize(IBTTransportProxy tp, string url, IBTTransportConfig callBack)
        {
            lock (this)
            {
                while (false == _initialized)
                {
                    IBTTransportConfig cb = null;

                    if (null == url)
                    {
                        throw new ArgumentNullException("Url may not be null");
                    }

                    if (null == callBack)
                    {
                        cb = this;
                    }
                    else
                    {
                        cb = callBack;
                    }

                    if (null == tp && null == _tp)
                    {
                        _tp = new IBTTransportProxy();
                    }
                    else if (null != tp)
                    {
                        _tp = tp;
                    }

                    _tp.RegisterIsolatedReceiver(url, cb);
                    _mf = _tp.GetMessageFactory();

                    _initialized = true;
                }
            }
        }
        /// <summary>
        /// This method is called when a Receive Location is enabled.
        /// </summary>
        public override void Open(
            string uri,
            IPropertyBag config,
            IPropertyBag bizTalkConfig,
            IPropertyBag handlerPropertyBag,
            IBTTransportProxy transportProxy,
            string transportType,
            string propertyNamespace,
            ControlledTermination control)
        {
            Trace.WriteLine("[DotNetFileReceiverEndpoint] Open called");
            this.errorCount = 0;

            this.properties = new DotNetFileReceiveProperties();

            //  Location properties - possibly override some Handler properties
            XmlDocument locationConfigDom = ConfigProperties.ExtractConfigDom(config);

            this.properties.ReadLocationConfiguration(locationConfigDom);

            //  this is our handle back to the EPM
            this.transportProxy = transportProxy;

            // used to create new messages / message parts etc.
            this.messageFactory = this.transportProxy.GetMessageFactory();

            //  used in the creation of messages
            this.transportType = transportType;

            //  used in the creation of messages
            this.propertyNamespace = propertyNamespace;

            // used to track inflight work for shutting down properly
            this.controlledTermination = control;

            //start the task
            Start();
        }
        public override void Open(string uri, IPropertyBag config, IPropertyBag bizTalkConfig, IPropertyBag handlerPropertyBag, IBTTransportProxy transportProxy, string transportType, string propertyNamespace, ControlledTermination controlledTermination)
        {
            this.transportProxy        = transportProxy;
            this.transportType         = transportType;
            this.uri                   = uri;
            this.controlledTermination = controlledTermination;

            this.adapterConfiguration = new AdapterConfiguration();
            object property = null;

            config.Read("AdapterConfig", out property, 0);
            if (property != null)
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml((string)property);
                this.adapterConfiguration.Load(document);
            }
            //  create and schedule a new the task
            this.taskController = new TaskController(new ScheduledTask(this.adapterConfiguration.Name, new ScheduledTask.TaskDelegate(this.ControlledEndpointTask)), this.adapterConfiguration.Schedule);
            this.taskController.StateChanged += new StateChangedEventHandler(this.OnStateChanged);
            this.taskController.Enabled       = true;
            this.taskController.Start();
        }
		public ResponseCallback(TpBatchAsyncCallback batchCallBack, IBTTransportProxy transportProxy)
		{
			_batchCallBack = batchCallBack;
		    _transportProxy = transportProxy;
		}
		/// <summary>
		/// Empty method, needed for IBTTransmitter interface
		/// </summary>
		/// <param name="transportProxy"></param>
		public void Initialize(IBTTransportProxy transportProxy)
		{
		}
 public TransmitResponseBatch(IBTTransportProxy transportProxy, AllWorkDoneDelegate allWorkDoneDelegate)
     : base(transportProxy, true)
 {
     this.allWorkDoneDelegate = allWorkDoneDelegate;
 }
Example #35
0
 public TransmitResponseBatch(IBTTransportProxy transportProxy, AllWorkDoneDelegate allWorkDoneDelegate)
     : base(transportProxy, true)
 {
     this.allWorkDoneDelegate = allWorkDoneDelegate;
 }
		/// <summary>
		/// Close the adapter
		/// </summary>
		public void Close()
		{
			if ( null != _tp )
			{
				_tp.TerminateIsolatedReceiver();
			}

            _initialized = false;
			_tp = null;
		}
Example #37
0
 /// <summary>
 /// Initialize the Adapter
 /// </summary>
 /// <param name="transportProxy">Transport Proxy reference</param>
 public void Initialize(IBTTransportProxy transportProxy)
 {
     _terminate.Enter();
      _tp = transportProxy;
 }
 public SyncReceiveSubmitBatch(IBTTransportProxy transportProxy, ControlledTermination control, int depth)
     : this(transportProxy, control, new ManualResetEvent(false), depth)
 {
 }
Example #39
0
 /// <summary>
 /// Terminate the adapter
 /// </summary>
 /// <remarks>
 /// Wait for all send operations to end,
 /// then release the transport proxy and terminate
 /// </remarks>
 public void Terminate()
 {
     _terminate.Leave();
      _terminate.Terminate();
      Marshal.ReleaseComObject(_tp);
      _tp = null;
 }
		/// <summary>
		/// Creatable receiver constructor
		/// </summary>
		/// <param name="tp">Transport proxy object reference</param>
		public BizTalkMessaging(IBTTransportProxy tp)
		{
			if ( null == tp )
				throw new ArgumentNullException("IBTTransportProxy may not be null");

			this._tp = tp;
			_mf = _tp.GetMessageFactory();

			_initialized = true;
		}
		/// <summary>
		/// Initialize the adapter by taken the address of receive location from message context
		/// </summary>
		/// <param name="tp">Transport proxy object reference</param>
		/// <param name="message">BizTalk message object reference</param>
		/// <param name="callBack">Reference to the configuration callback interface</param>
		private void InternalInitialize(IBTTransportProxy tp, IBaseMessage message, IBTTransportConfig callBack)
		{
			IBaseMessageContext	ctx;
			ctx = message.Context;
			SystemMessageContext smc = new SystemMessageContext(ctx);
			string url = smc.InboundTransportLocation;

			InternalInitialize(tp, url, callBack);
		}
		/// <summary>
		/// Initialize the adapter by specifying the address of the receive location that uses the adapter
		/// </summary>
		/// <param name="tp">Transport proxy object reference</param>
		/// <param name="url">Address of the receive location</param>
		/// <param name="callBack">Reference to the configuration callback interface</param>
		private void InternalInitialize(IBTTransportProxy tp, string url, IBTTransportConfig callBack)
		{
			lock(this)
			{
				while ( false == _initialized )
				{
					IBTTransportConfig cb = null;

					if ( null == url )
						throw new ArgumentNullException("Url may not be null");

					if ( null == callBack )
					{
						cb = this;
					}
					else
					{
						cb = callBack;
					}
				
					if ( null == tp && null == _tp )
					{
						_tp = new IBTTransportProxy();
					}
					else if ( null != tp )
					{
						_tp = tp;
					}

					_tp.RegisterIsolatedReceiver(url, cb);
					_mf = _tp.GetMessageFactory();

					_initialized = true;
				}
			}
		}
 public TransactionalDeleteBatch(IBTTransportProxy transportProxy, ControlledTermination control, CommittableTransaction transaction)
     : base(transportProxy, control, transaction, null, true)
 {
 }
		/// <summary>
		/// Initialize the adapter by explicitely setting the receive location URI.
		/// </summary>
		/// <param name="tp">Transport proxy object reference</param>
		/// <param name="url">Address of the receive location that used this adapter</param>
		/// <param name="callBack">Reference to the configuration callback interface</param>
		public void Initialize(IBTTransportProxy tp, string url, IBTTransportConfig callBack)
		{
			InternalInitialize( tp, url, callBack );
		}
 public Batch(IBTTransportProxy transportProxy, bool makeSuccessCall)
 {
     this.hrStatus = -1;
     this.transportProxy = transportProxy;
     this.transportBatch = this.transportProxy.GetBatch(this, null);
     this.makeSuccessCall = makeSuccessCall;
 }