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); }
override public IBaseMessage EndSubmitSyncMessage( IAsyncResult ar) { if (false == _initialized) { throw new InvalidOperationException("BizTalkMessaging is not initialized."); } EpmAsyncResult epmAr = (EpmAsyncResult)ar; bool res = epmAr.AsyncWaitHandle.WaitOne(); if (true == res) { return(epmAr.ResponseCallback.Response); } else { return(null); } }
override public bool EndSubmitMessages( IAsyncResult ar) { if (false == _initialized) { throw new InvalidOperationException("BizTalkMessaging is not initialized."); } EpmAsyncResult tpAr = (EpmAsyncResult)ar; TpBatchStatus tpStatus = tpAr.BatchCallback.GetStatus(); if (0 <= tpStatus.status) { return(true); } else { return(false); } }