public KafkaMessagingClient(IDistributedSearchConfiguration demoCredential, TopicAndPartition topicAndPartition)
        {
            var bootstrapServers = $"{demoCredential.EventHubName}.servicebus.windows.net:9093";
            var saslUsername     = "******";
            var saslPassword     = demoCredential.EventHubConnectionString;
            var securityProtocol = SecurityProtocol.SaslSsl;
            var saslMechanism    = SaslMechanism.Plain;
            var groupId          = "$Default";

            this.producer = new ProducerBuilder <Null, string>(new ProducerConfig
            {
                BootstrapServers = bootstrapServers,
                SecurityProtocol = securityProtocol,
                SaslMechanism    = saslMechanism,
                SaslUsername     = saslUsername,
                SaslPassword     = saslPassword,

                // SslCaLocation = cacertlocation,
                // Debug = "security,broker,protocol",
            })
                            .SetKeySerializer(Serializers.Null)
                            .SetValueSerializer(Serializers.Utf8)
                            .Build();

            this.consumer = new ConsumerBuilder <Ignore, string>(new ConsumerConfig
            {
                BootstrapServers      = bootstrapServers,
                SecurityProtocol      = securityProtocol,
                SaslMechanism         = saslMechanism,
                SaslUsername          = saslUsername,
                SaslPassword          = saslPassword,
                GroupId               = groupId,
                BrokerVersionFallback = "1.0.0",
                AutoOffsetReset       = AutoOffsetReset.Latest,

                // SslCaLocation = cacertlocation,
                // Debug = "security,broker,protocol",
            })
                            .SetKeyDeserializer(Deserializers.Ignore)
                            .SetValueDeserializer(Deserializers.Utf8)
                            .Build();

            this.adminClient = new AdminClientBuilder(new AdminClientConfig
            {
                BootstrapServers = bootstrapServers,
                SecurityProtocol = securityProtocol,
                SaslMechanism    = saslMechanism,
                SaslUsername     = saslUsername,
                SaslPassword     = saslPassword,
            }).Build();

            this.topicPartition = new Lazy <TopicPartition>(() => new TopicPartition(
                                                                topic: topicAndPartition.TopicName,
                                                                partition: DeterminePartitionID(this.adminClient, topicAndPartition)));
        }
 public BusinessDataPump(
     IDistributedSearchConfiguration demoCredential,
     Func <TBusinessData> createEmptyBusinessData,
     Func <TBusinessData, TBusinessDataUpdate, TBusinessData> applyUpdate,
     BlobContainerClient snapshotContainerClient)
 {
     this.applyUpdate             = applyUpdate;
     this.createEmptyBusinessData = createEmptyBusinessData;
     this.updateMessagingClient   =
         MessagingClients.Updates <TBusinessDataUpdate>(demoCredential: demoCredential);
     this.snapshotContainerClient = snapshotContainerClient;
 }
        public SearchServiceStartup(IConfiguration configuration)
        {
            this.Configuration  = configuration;
            this.demoCredential = new DemoCredential();

            var computeNodeId = 100;

            this.responseTopicAndPartition = new TopicAndPartition(
                topicName: this.demoCredential.EventHubTopicNameResponses,
                partitionSpecification: PartitionSpecification.NewComputeNodeID(computeNodeId));

            this.snapshotContainerClient = new BlobContainerClient(
                blobContainerUri: new Uri($"https://{this.demoCredential.BusinessDataSnapshotAccountName}.blob.core.windows.net/{this.demoCredential.BusinessDataSnapshotContainerName}/"),
                credential: this.demoCredential.AADServicePrincipal);
        }
        public ServiceBusMessagingClient(IDistributedSearchConfiguration demoCredential)
        {
            this.configuration = demoCredential;

            this.serviceBusClient = new ServiceBusClient(
                connectionString: demoCredential.ServiceBusConnectionString);

            this.topicClient = this.serviceBusClient.CreateSender(
                queueOrTopicName: demoCredential.ServiceBusTopicNameRequests);

            this.subscriptionClient = this.serviceBusClient.CreateProcessor(
                topicName: demoCredential.ServiceBusTopicNameRequests,
                subscriptionName: demoCredential.ProviderName,
                options: new ServiceBusProcessorOptions
            {
                ReceiveMode = ServiceBusReceiveMode.ReceiveAndDelete,
            });
        }
 public static IWatermarkMessageClient <T> Updates <T>(IDistributedSearchConfiguration demoCredential)
 => new KafkaMessagingClient <T>(
     demoCredential: demoCredential,
     topicAndPartition: new TopicAndPartition(
         topicName: demoCredential.EventHubTopicNameBusinessDataUpdates,
         partitionSpecification: PartitionSpecification.NewPartitionID(0)));
 public static IRequestResponseMessageClient <T> Responses <T>(IDistributedSearchConfiguration demoCredential, TopicAndPartition topicAndPartition)
 => new KafkaMessagingClient <T>(demoCredential: demoCredential, topicAndPartition: topicAndPartition);
 public static IRequestResponseMessageClient <T> Requests <T>(IDistributedSearchConfiguration demoCredential)
 => new ServiceBusMessagingClient <T>(demoCredential: demoCredential);
Exemple #8
0
 public BusinessDataStartup(IConfiguration configuration)
 {
     this.Configuration  = configuration;
     this.demoCredential = new DemoCredential();
 }