Click here to Skip to main content
15,894,410 members
Articles / Programming Languages / C#

WCF: Duplex MSMQ

Rate me:
Please Sign up or sign in to vote.
4.96/5 (29 votes)
3 Sep 2009Ms-PL11 min read 148.6K   2K   97  
How to use duplex communication over MSMQ bindings.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace SlasheneFramework.WCF
{
	public abstract class ProxyOutputChannel : IOutputChannel
	{
		public ProxyOutputChannel(IOutputChannel inner)
		{
			_InnerOutputChannel = inner;
		}
		private readonly IOutputChannel _InnerOutputChannel;

		public virtual System.ServiceModel.EndpointAddress RemoteAddress
		{
			get
			{
				return _InnerOutputChannel.RemoteAddress;
			}
		}
		public virtual System.Uri Via
		{
			get
			{
				return _InnerOutputChannel.Via;
			}
		}
		public virtual System.ServiceModel.CommunicationState State
		{
			get
			{
				return _InnerOutputChannel.State;
			}
		}
		public virtual event System.EventHandler Closed
		{

			add
			{
				_InnerOutputChannel.Closed += value;
			}

			remove
			{
				_InnerOutputChannel.Closed -= value;
			}
		}
		public virtual event System.EventHandler Closing
		{

			add
			{
				_InnerOutputChannel.Closing += value;
			}

			remove
			{
				_InnerOutputChannel.Closing -= value;
			}
		}
		public virtual event System.EventHandler Faulted
		{

			add
			{
				_InnerOutputChannel.Faulted += value;
			}

			remove
			{
				_InnerOutputChannel.Faulted -= value;
			}
		}
		public virtual event System.EventHandler Opened
		{

			add
			{
				_InnerOutputChannel.Opened += value;
			}

			remove
			{
				_InnerOutputChannel.Opened -= value;
			}
		}
		public virtual event System.EventHandler Opening
		{

			add
			{
				_InnerOutputChannel.Opening += value;
			}

			remove
			{
				_InnerOutputChannel.Opening -= value;
			}
		}

		public virtual void Send(System.ServiceModel.Channels.Message message)
		{
			_InnerOutputChannel.Send(message);
		}
		public virtual void Send(System.ServiceModel.Channels.Message message, System.TimeSpan timeout)
		{
			_InnerOutputChannel.Send(message, timeout);
		}
		public virtual System.IAsyncResult BeginSend(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, System.Object state)
		{
			return _InnerOutputChannel.BeginSend(message, callback, state);
		}
		public virtual System.IAsyncResult BeginSend(System.ServiceModel.Channels.Message message, System.TimeSpan timeout, System.AsyncCallback callback, System.Object state)
		{
			return _InnerOutputChannel.BeginSend(message, timeout, callback, state);
		}
		public virtual void EndSend(System.IAsyncResult result)
		{
			_InnerOutputChannel.EndSend(result);
		}
		public virtual T GetProperty<T>() where T : class
		{
			return _InnerOutputChannel.GetProperty<T>();
		}
		public virtual void Abort()
		{
			_InnerOutputChannel.Abort();
		}
		public virtual void Close()
		{
			_InnerOutputChannel.Close();
		}
		public virtual void Close(System.TimeSpan timeout)
		{
			_InnerOutputChannel.Close(timeout);
		}
		public virtual System.IAsyncResult BeginClose(System.AsyncCallback callback, System.Object state)
		{
			return _InnerOutputChannel.BeginClose(callback, state);
		}
		public virtual System.IAsyncResult BeginClose(System.TimeSpan timeout, System.AsyncCallback callback, System.Object state)
		{
			return _InnerOutputChannel.BeginClose(timeout, callback, state);
		}
		public virtual void EndClose(System.IAsyncResult result)
		{
			_InnerOutputChannel.EndClose(result);
		}
		public virtual void Open()
		{
			_InnerOutputChannel.Open();
		}
		public virtual void Open(System.TimeSpan timeout)
		{
			_InnerOutputChannel.Open(timeout);
		}
		public virtual System.IAsyncResult BeginOpen(System.AsyncCallback callback, System.Object state)
		{
			return _InnerOutputChannel.BeginOpen(callback, state);
		}
		public virtual System.IAsyncResult BeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, System.Object state)
		{
			return _InnerOutputChannel.BeginOpen(timeout, callback, state);
		}
		public virtual void EndOpen(System.IAsyncResult result)
		{
			_InnerOutputChannel.EndOpen(result);
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer Freelance
France France
I am currently the CTO of Metaco, we are leveraging the Bitcoin Blockchain for delivering financial services.

I also developed a tool to make IaaS on Azure more easy to use IaaS Management Studio.

If you want to contact me, go this way Smile | :)

Comments and Discussions