Exemple #1
0
        /// <summary>
        /// Creates an event listener that logs using a <see cref="EventHubAmqpSink" />.
        /// </summary>
        /// <param name="eventHubConnectionString">The connection string for the eventhub.</param>
        /// <param name="eventHubName">The name of the eventhub.</param>
        /// <param name="bufferingInterval">The buffering interval between each batch publishing.</param>
        /// <param name="bufferingCount">The number of entries that will trigger a batch publishing.</param>
        /// <param name="listenerDisposeTimeout">Defines a timeout interval for the flush operation when the listener is disposed.</param>
        /// <param name="maxBufferSize">The maximum number of entries that can be buffered while it's sending to Azure EventHub before the sink starts dropping entries.
        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Calling <see cref="IDisposable.Dispose" /> on
        /// the <see cref="EventListener" /> will block until all the entries are flushed or the interval elapses.
        /// If <see langword="null" /> is specified, then the call will block indefinitely until the flush operation finishes.</param>
        /// <param name="partitionKey">PartitionKey is optional. If no partition key is supplied the log messages are sent to eventhub
        /// and distributed to various partitions in a round robin manner.</param>
        /// <returns>
        /// An event listener that uses <see cref="EventHubAmqpSink" /> to log events.
        /// </returns>
        public static EventListener CreateListener(string eventHubConnectionString, string eventHubName, TimeSpan?bufferingInterval = null, int bufferingCount = Buffering.DefaultBufferingCount, TimeSpan?listenerDisposeTimeout = null, int maxBufferSize = Buffering.DefaultMaxBufferSize, string partitionKey = null)
        {
            var listener = new ObservableEventListener();

            listener.LogToEventHubUsingAmqp(eventHubConnectionString, eventHubName, bufferingInterval, bufferingCount, listenerDisposeTimeout, maxBufferSize, partitionKey);
            return(listener);
        }
 /// <summary>
 /// Creates an event listener that logs using a <see cref="EventHubAmqpSink" />.
 /// </summary>
 /// <param name="eventHubConnectionString">The connection string for the eventhub.</param>
 /// <param name="eventHubName">The name of the eventhub.</param>
 /// <param name="bufferingInterval">The buffering interval between each batch publishing.</param>
 /// <param name="bufferingCount">The number of entries that will trigger a batch publishing.</param>
 /// <param name="listenerDisposeTimeout">Defines a timeout interval for the flush operation when the listener is disposed.</param>
 /// <param name="maxBufferSize">The maximum number of entries that can be buffered while it's sending to Azure EventHub before the sink starts dropping entries.
 /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Calling <see cref="IDisposable.Dispose" /> on
 /// the <see cref="EventListener" /> will block until all the entries are flushed or the interval elapses.
 /// If <see langword="null" /> is specified, then the call will block indefinitely until the flush operation finishes.</param>
 /// <param name="partitionKey">PartitionKey is optional. If no partition key is supplied the log messages are sent to eventhub 
 /// and distributed to various partitions in a round robin manner.</param>
 /// <returns>
 /// An event listener that uses <see cref="EventHubAmqpSink" /> to log events.
 /// </returns>
 public static EventListener CreateListener(string eventHubConnectionString, string eventHubName, TimeSpan? bufferingInterval = null, int bufferingCount = Buffering.DefaultBufferingCount, TimeSpan? listenerDisposeTimeout = null, int maxBufferSize = Buffering.DefaultMaxBufferSize, string partitionKey = null)
 {
     var listener = new ObservableEventListener();
     listener.LogToEventHubUsingAmqp(eventHubConnectionString, eventHubName, bufferingInterval, bufferingCount, listenerDisposeTimeout, maxBufferSize, partitionKey);
     return listener;
 }