Example #1
0
        public void AddPublishChannel(string address)
        {
            lock (this)
            {
                if (links.Any(l => l.Address == address))
                {
                    throw new Exception("A channel already exists for this address");
                }

                AmqpSenderLink link = new AmqpSenderLink(NetworkUri, address, Endpoint.CFXHandle);
                links.Add(link);
            }
        }
Example #2
0
        public void PublishToChannel(CFXEnvelope env, string address)
        {
            EnsureConnection();

            AmqpSenderLink link = links.OfType <AmqpSenderLink>().Where(l => l.Address == address).FirstOrDefault();

            if (link == null)
            {
                throw new ArgumentException("There is no active publish channel that matches the specified channel address", "address");
            }

            link.Publish(new CFXEnvelope[] { env });
        }
Example #3
0
        public void AddPublishChannel(string address, bool connectImmediately = false)
        {
            lock (this)
            {
                if (links.Any(l => l.Address == address))
                {
                    throw new Exception("A channel already exists for this address");
                }

                AmqpSenderLink link = new AmqpSenderLink(NetworkUri, address, Endpoint.CFXHandle);
                links.Add(link);
            }

            if (connectImmediately)
            {
                EnsureConnection();
            }
        }