Exemple #1
0
        protected ChangeNotifierBase(IConfiguration config)
        {
            var protocol     = Settings.AMQP_PROTOCOL(config);
            var policyName   = Settings.AMQP_POLICY_NAME(config);
            var policyKey    = Settings.AMQP_POLICY_KEY(config);
            var namespaceUrl = Settings.AMQP_NAMESPACE_URL(config);
            var connStr      = $"{protocol}://{policyName}:{policyKey}@{namespaceUrl}/";

            _address     = new Address(connStr);
            _ttlMins     = Settings.AMQP_TTL_MINS(config);
            _topicPrefix = Settings.AMQP_TOPIC_PREFIX(config);
        }
        protected ChangeReceiverBase(IConfiguration config)
        {
            _topicPrefix = Settings.AMQP_TOPIC_PREFIX(config);
            _isAzure     = Settings.USE_AZURE_SERVICE_BUS(config);

            var protocol     = Settings.AMQP_PROTOCOL(config);
            var policyName   = Settings.AMQP_POLICY_NAME(config);
            var policyKey    = Settings.AMQP_POLICY_KEY(config);
            var namespaceUrl = Settings.AMQP_NAMESPACE_URL(config);
            var connStr      = $"{protocol}://{policyName}:{policyKey}@{namespaceUrl}/";
            var address      = new Address(connStr);
            var connection   = new Connection(address);
            var session      = new Session(connection);
            var topicAddress = GetTopicAddress();
            var receiver     = new ReceiverLink(session, GetType().Name, topicAddress);

            receiver.Start(100, (rec, msg) =>
            {
                ProcessMessage(rec, msg);

                rec.Accept(msg);
            });
        }