本文整理汇总了C#中ObservableEventListener.LogToEventHubUsingAmqp方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableEventListener.LogToEventHubUsingAmqp方法的具体用法?C# ObservableEventListener.LogToEventHubUsingAmqp怎么用?C# ObservableEventListener.LogToEventHubUsingAmqp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObservableEventListener
的用法示例。
在下文中一共展示了ObservableEventListener.LogToEventHubUsingAmqp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateListener
/// <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;
}