Exemplo n.º 1
0
 public Batch(IBTTransportProxy transportProxy, bool makeSuccessCall)
 {
     _hrStatus        = -1;
     _transportProxy  = transportProxy;
     _transportBatch  = _transportProxy.GetBatch(this, null);
     _makeSuccessCall = makeSuccessCall;
 }
Exemplo n.º 2
0
        private void DeleteTransmitMessage(object state)
        {
            IBTTransportBatch batch = _transportProxy.GetBatch(new DeleteBatchCallback(this._evt), null);

            batch.DeleteMessage((IBaseMessage)state);
            batch.Done(null);
        }
        private void EndpointTask()
        {
            //Stream readonlystream = null;
            object provider      = null;
            object taskArguments = null;

            try
            {
                try
                {
                    Assembly streamProviderAssembly = Assembly.Load(this.properties.StreamProviderAssemblyName);
                    provider = streamProviderAssembly.CreateInstance(this.properties.StreamProviderTypeName);
                }
                catch (Exception provderException)
                {
                    transportProxy.SetErrorInfo(new ApplicationException("Error creating IScheduledTaskStreamProvider interface", provderException));
                }
                if (provider != null)
                {
                    //create GetStream argument object
                    object [] args   = new object [] {};
                    object    result = provider.GetType().InvokeMember("GetParameterType", BindingFlags.InvokeMethod, null, provider, args);
                    if (result != null)
                    {
                        StringReader  strReader  = new StringReader(this.properties.StreamProviderArguments);
                        XmlSerializer serializer = new XmlSerializer((System.Type)result);
                        taskArguments = serializer.Deserialize(strReader);
                    }
                    //call GetStream
                    args   = new object[] { taskArguments };
                    result = provider.GetType().InvokeMember("GetStream", BindingFlags.InvokeMethod, null, provider, args);

                    if (result != null)
                    {
                        Stream readonlystream = new ReadOnlySeekableStream((Stream)result);

                        IBaseMessageFactory messageFactory = this.transportProxy.GetMessageFactory();
                        IBTTransportBatch   batch          = transportProxy.GetBatch(this, null);

                        IBaseMessage message = this.CreateMessage(messageFactory, readonlystream, this.properties.Name);

                        batch.SubmitMessage(message);
                        batch.Done(null);
                        this.batchFinished.WaitOne();
                    }
                }
            }
            catch (Exception exception)
            {
                string errorMessage = exception.Message;
                //transportProxy.SetErrorInfo(exception);
                while (exception.InnerException != null)
                {
                    exception     = exception.InnerException;
                    errorMessage += "\r\n" + exception.Message;
                }
                transportProxy.ReceiverShuttingdown(this.uri, new ScheduledException(errorMessage));
            }
        }
Exemplo n.º 4
0
        override public IAsyncResult BeginSubmitMessage(
            IBaseMessage message,
            AsyncCallback cb,
            Object asyncState)
        {
            if (false == _initialized)
            {
                InternalInitialize(null, message, null);
            }

            EpmAsyncResult ar = new EpmAsyncResult(cb, asyncState);

            // Get a new Transport Proxy Batch
            IBTTransportBatch batch = _tp.GetBatch(ar.BatchCallback, null);

            // Submit the message
            batch.SubmitMessage(message);

            // Commit the batch
            batch.Done(null);

            return(ar);
        }