Example #1
0
        public static async Task <EventHubPartitionCheckpoint> Create(ICheckpointSettings settings, string streamProviderName, string partition)
        {
            var checkpoint = new EventHubPartitionCheckpoint(settings, streamProviderName, partition);
            await checkpoint.Initialize();

            return(checkpoint);
        }
Example #2
0
        /// <summary>
        /// Factory initialization.
        /// Provider config must contain the event hub settings type or the settings themselves.
        /// EventHubSettingsType is recommended for consumers that do not want to include secure information in the cluster configuration.
        /// </summary>
        /// <param name="providerConfig"></param>
        /// <param name="providerName"></param>
        /// <param name="log"></param>
        /// <param name="svcProvider"></param>
        public void Init(IProviderConfiguration providerConfig, string providerName, Logger log, IServiceProvider svcProvider)
        {
            if (providerConfig == null)
            {
                throw new ArgumentNullException("providerConfig");
            }
            if (string.IsNullOrWhiteSpace(providerName))
            {
                throw new ArgumentNullException("providerName");
            }
            if (log == null)
            {
                throw new ArgumentNullException("log");
            }
            if (svcProvider == null)
            {
                throw new ArgumentNullException("svcProvider");
            }

            logger          = log;
            serviceProvider = svcProvider;
            adapterConfig   = new EventHubStreamProviderConfig(providerName);
            adapterConfig.PopulateFromProviderConfig(providerConfig);

            hubSettings        = adapterConfig.GetEventHubSettings(providerConfig, serviceProvider);
            checkpointSettings = adapterConfig.GetCheckpointSettings(providerConfig, serviceProvider);

            receivers  = new ConcurrentDictionary <QueueId, EventHubAdapterReceiver>();
            client     = EventHubClient.CreateFromConnectionString(hubSettings.ConnectionString, hubSettings.Path);
            bufferPool = new FixedSizeObjectPool <FixedSizeBuffer>(adapterConfig.CacheSizeMb, pool => new FixedSizeBuffer(1 << 20, pool));
        }
 private EventHubPartitionCheckpoint(ICheckpointSettings settings, string streamProviderName, string partition)
 {
     if (settings == null)
     {
         throw new ArgumentNullException("settings");
     }
     if (string.IsNullOrWhiteSpace(streamProviderName))
     {
         throw new ArgumentNullException("streamProviderName");
     }
     if (string.IsNullOrWhiteSpace(partition))
     {
         throw new ArgumentNullException("partition");
     }
     persistInterval = settings.PersistInterval;
     dataManager = new AzureTableDataManager<EventHubPartitionCheckpointEntity>(settings.TableName, settings.DataConnectionString);
     entity = EventHubPartitionCheckpointEntity.Create(streamProviderName, settings.CheckpointNamespace, partition);
 }
Example #4
0
 private EventHubPartitionCheckpoint(ICheckpointSettings settings, string streamProviderName, string partition)
 {
     if (settings == null)
     {
         throw new ArgumentNullException("settings");
     }
     if (string.IsNullOrWhiteSpace(streamProviderName))
     {
         throw new ArgumentNullException("streamProviderName");
     }
     if (string.IsNullOrWhiteSpace(partition))
     {
         throw new ArgumentNullException("partition");
     }
     persistInterval = settings.PersistInterval;
     dataManager     = new AzureTableDataManager <EventHubPartitionCheckpointEntity>(settings.TableName, settings.DataConnectionString);
     entity          = EventHubPartitionCheckpointEntity.Create(streamProviderName, settings.CheckpointNamespace, partition);
 }
 public static async Task<EventHubPartitionCheckpoint> Create(ICheckpointSettings settings, string streamProviderName, string partition)
 {
     var checkpoint = new EventHubPartitionCheckpoint(settings, streamProviderName, partition);
     await checkpoint.Initialize();
     return checkpoint;
 }