public async Task OpenAsync(AzurePartitionContext context) { IEventHubPartitionContext partitionContext = new EventHubPartitionContext(context); await this.eventProcessor.OpenAsync(partitionContext); }
public IAzureEventProcessor CreateEventProcessor( AzurePartitionContext context) { IEventHubPartitionContext partitionContext = new EventHubPartitionContext(context); AzureEventProcessor azureEventProcessor = new AzureEventProcessor(this.eventProcessor); return(azureEventProcessor); }
public async Task ProcessErrorAsync( AzurePartitionContext context, Exception error) { IEventHubPartitionContext partitionContext = new EventHubPartitionContext(context); await this.eventProcessor.ProcessErrorAsync( partitionContext, error); }
public async Task CloseAsync( AzurePartitionContext context, AzureCloseReason reason) { IEventHubPartitionContext partitionContext = new EventHubPartitionContext(context); EventProcessorCloseReason closeReason = reason.ToEventProcessorCloseReason(); await this.eventProcessor.CloseAsync( partitionContext, closeReason); }
public async Task ProcessEventsAsync( AzurePartitionContext context, IEnumerable <AzureEventData> messages) { IEventHubPartitionContext partitionContext = new EventHubPartitionContext(context); IEnumerable <IEventData> eventDatas = messages.Select( azureEventData => new EventData(azureEventData)); await this.eventProcessor.ProcessEventsAsync( partitionContext, eventDatas); }
/// <summary> /// Initializes a new instance of the <see cref="EventHubPartitionContext"/> class. /// </summary> /// <param name="azurePartitionContext">The <see cref="AzurePartitionContext"/> instance.</param> /// <exception cref="ArgumentNullException"> /// Thrown if the given <see cref="AzurePartitionContext"/> instance is null. /// </exception> public EventHubPartitionContext( AzurePartitionContext azurePartitionContext) { Checks.Parameter( nameof(azurePartitionContext), azurePartitionContext) .NotNull(); this.azurePartitionContext = azurePartitionContext; this.lazyReceiverRuntimneInfo = new Lazy <EventHubReceiverRuntimeInformation>( () => new EventHubReceiverRuntimeInformation( this.azurePartitionContext.RuntimeInformation)); }
public void ProcessEvents([EventHubTrigger("sita-apc-flex", Connection = "TestEventHubConnection")] EventData[] events, ILogger log, Microsoft.Azure.EventHubs.Processor.PartitionContext partitionContext) { foreach (var evt in events) { log.LogTrace(new EventId(505, "Event Processed"), $"Event processed (Offset={evt.SystemProperties.Offset}, " + $"SequenceNumber={evt.SystemProperties.SequenceNumber}, " + $"EnqueueTimeUtc={evt.SystemProperties.EnqueuedTimeUtc}, " + $"EnqueueTime-Now={System.DateTime.UtcNow.Subtract(evt.SystemProperties.EnqueuedTimeUtc).TotalMilliseconds}, " + $"PartitionId={partitionContext.PartitionId})"); } }