Example #1
0
        public void Send <T>(T message)
        {
            _fiber.Add(() =>
            {
                try
                {
                    var envelope = new WcfMessageEnvelope
                    {
                        MessageType = typeof(T).AssemblyQualifiedName,
                        Body        = Serializer.Serialize(message),
                    };

                    WcfChannel <WcfMessageEnvelope> proxy = _channelFactory.CreateChannel();
                    proxy.Send(envelope);

                    var channel = proxy as IClientChannel;
                    if (channel != null)
                    {
                        channel.Close();
                    }

                    var disposable = proxy as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
                catch
                {
                    // i hate doing this, but we don't want to take down the entire appdomain
                }
            });
        }
Example #2
0
        public void Send <T>(T message)
        {
            _fiber.Add(() =>
            {
                var envelope = new WcfMessageEnvelope
                {
                    MessageType = typeof(T).AssemblyQualifiedName,
                    Body        = Serializer.Serialize(message),
                };

                _proxy.Send(envelope);
            });
        }