private void DeleteTransmitMessage(object state) { IBTTransportBatch batch = _transportProxy.GetBatch(new DeleteBatchCallback(this._evt), null); batch.DeleteMessage((IBaseMessage)state); batch.Done(null); }
override public IAsyncResult BeginSubmitSyncMessage( IBaseMessage message, AsyncCallback cb, Object asyncState) { if (false == _initialized) { InternalInitialize(null, message, null); } Guid ct = Guid.NewGuid(); string correlationToken = ct.ToString(); EpmAsyncResult ar = new EpmAsyncResult(cb, asyncState); ResponseCallback responseCallback = new ResponseCallback(ar.BatchCallback, _tp); ar.ResponseCallback = responseCallback; // Get a new Transport Proxy Batch IBTTransportBatch batch = _tp.GetBatch(ar.BatchCallback, null); // Submit the message batch.SubmitRequestMessage(message, correlationToken, true, new DateTime(0), responseCallback); // Commit the batch batch.Done(null); return(ar); }
override public IAsyncResult BeginSubmitMessages( IBaseMessage[] messages, AsyncCallback cb, Object asyncState) { if (false == _initialized) { InternalInitialize(null, messages[0], null); } EpmAsyncResult ar = new EpmAsyncResult(cb, asyncState); // Get a new Transport Proxy Batch IBTTransportBatch batch = _tp.GetBatch(ar.BatchCallback, null); for (int c = 0; c < messages.Length; c++) { // Submit the message batch.SubmitMessage(messages[c]); } // Commit the batch batch.Done(null); return(ar); }
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)); } }