コード例 #1
0
ファイル: Session.cs プロジェクト: ChugR/Apache.NMS.AMQP
        private Org.Apache.Qpid.Messaging.Session qpidSession = null; // Don't create until Start()

        public Session(Connection connection, int sessionId, AcknowledgementMode acknowledgementMode)
        {
            this.connection = connection;
            this.acknowledgementMode = acknowledgementMode;
            MessageConverter = connection.MessageConverter;
            id = sessionId;
            if (this.acknowledgementMode == AcknowledgementMode.Transactional)
            {
                // TODO: transactions
                throw new NotSupportedException("Transactions are not supported by Qpid/Amqp");
            }
            if (connection.IsStarted)
            {
                this.Start();
            }
            connection.AddSession(this);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new connection to Qpid/Amqp.
        /// </summary>
        public IConnection CreateConnection(string userName, string password)
        {
            Connection connection = new Connection();

            connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as IRedeliveryPolicy;
            //connection.ConsumerTransformer = this.consumerTransformer; // TODO:
            //connection.ProducerTransformer = this.producerTransformer; // TODO:
            connection.BrokerUri = this.BrokerUri;
            connection.ClientId = this.clientID;
            connection.ConnectionProperties = this.properties;

            if (!String.IsNullOrEmpty(userName))
            {
                connection.SetConnectionProperty(Connection.USERNAME_OPTION, userName);
            }
            if (!String.IsNullOrEmpty(password))
            {
                connection.SetConnectionProperty(Connection.PASSWORD_OPTION, password);
            }

            IConnection ReturnValue = null;
            ReturnValue = connection;

            return ReturnValue;
        }