protected void OnMessageReceived(params IMessageContext[] messageContexts) { messageContexts.ForEach(messageContext => { MessageProcessor.Process(messageContext.Key, () => ConsumeMessage(messageContext)); MessageCount++; }); }
protected void OnMessagesReceived(params IMessageContext[] messageContexts) { messageContexts.ForEach(messageContext => { var tagFilter = TagFilters.TryGetValue(messageContext.Topic); if (tagFilter != null) { if (tagFilter(messageContext.Tags)) { MessageProcessor.Process(messageContext.Key, () => ConsumeMessage(messageContext)); MessageCount++; } else { InternalConsumer.CommitOffset(messageContext); } } else { MessageProcessor.Process(messageContext.Key, () => ConsumeMessage(messageContext)); MessageCount++; } }); }
protected void OnMessagesReceived(params IMessageContext[] replies) { replies.ForEach(reply => { _messageProcessor.Process(reply.Key, () => ConsumeReply(reply)); }); }
// Token: 0x0600145A RID: 5210 RVA: 0x0007583C File Offset: 0x00073A3C private AssistantTaskContext CollectionStep(AssistantTaskContext context) { this.tracer.TraceFunction((long)this.GetHashCode(), "InferenceDataCollectionAssistant.CollectionStep"); ExAssert.RetailAssert(context != null, "Collection step invoked with a null task context"); StoreSession storeSession = context.Args.StoreSession; InferenceDataCollectionTaskContext inferenceDataCollectionTaskContext = context as InferenceDataCollectionTaskContext; ExAssert.RetailAssert(inferenceDataCollectionTaskContext != null, "Collection step invoked with an invalid task context. {0}", new object[] { context.GetType().FullName }); this.diagnosticLogger.LogInformation("Starting collection task. CollectionGuid={0}, Init={1}, Watermark={2}, MailboxGuid={3}, Name={4}", new object[] { inferenceDataCollectionTaskContext.MailboxProcessingState.CollectionGuid, inferenceDataCollectionTaskContext.MailboxProcessingState.IsInitialized, (inferenceDataCollectionTaskContext.MailboxProcessingState.Watermark == null) ? "None" : inferenceDataCollectionTaskContext.MailboxProcessingState.Watermark.DocumentId.ToString(), storeSession.MailboxGuid, storeSession.MailboxOwner.MailboxInfo.DisplayName }); Exception exception = null; MailboxProcessor.ProcessingResult processingResult; try { MailboxProcessor mailboxProcessor = new MailboxProcessor(this.collectionContext, storeSession, inferenceDataCollectionTaskContext.MailboxProcessingState); processingResult = mailboxProcessor.Process(); } catch (NonUniqueRecipientException ex) { processingResult = 1; exception = ex; } AssistantTaskContext result; if (processingResult == 2) { this.diagnosticLogger.LogInformation("Yielding collection task. CollectionGuid={0}, Init={1}, Watermark={2}, MailboxGuid={3}, Name={4}", new object[] { inferenceDataCollectionTaskContext.MailboxProcessingState.CollectionGuid, inferenceDataCollectionTaskContext.MailboxProcessingState.IsInitialized, (inferenceDataCollectionTaskContext.MailboxProcessingState.Watermark == null) ? "None" : inferenceDataCollectionTaskContext.MailboxProcessingState.Watermark.DocumentId.ToString(), storeSession.MailboxGuid, storeSession.MailboxOwner.MailboxInfo.DisplayName }); result = new InferenceDataCollectionTaskContext(context.MailboxData, context.Job, new AssistantStep(this.CollectionStep), inferenceDataCollectionTaskContext.MailboxProcessingState); } else { storeSession.Mailbox[MailboxSchema.InferenceDataCollectionProcessingState] = new byte[] { 1 }; storeSession.Mailbox.Save(); if (processingResult == 1) { this.diagnosticLogger.LogError("Failed collection task. CollectionGuid={0}, Init={1}, Watermark={2}, MailboxGuid={3}, Name={4}, Exception={5}", new object[] { inferenceDataCollectionTaskContext.MailboxProcessingState.CollectionGuid, inferenceDataCollectionTaskContext.MailboxProcessingState.IsInitialized, (inferenceDataCollectionTaskContext.MailboxProcessingState.Watermark == null) ? "None" : inferenceDataCollectionTaskContext.MailboxProcessingState.Watermark.DocumentId.ToString(), storeSession.MailboxGuid, storeSession.MailboxOwner.MailboxInfo.DisplayName, Util.StringizeException(exception) }); } else { this.diagnosticLogger.LogInformation("Finished collection task. CollectionGuid={0}, Init={1}, Watermark={2}, MailboxGuid={3}, Name={4}", new object[] { inferenceDataCollectionTaskContext.MailboxProcessingState.CollectionGuid, inferenceDataCollectionTaskContext.MailboxProcessingState.IsInitialized, (inferenceDataCollectionTaskContext.MailboxProcessingState.Watermark == null) ? "None" : inferenceDataCollectionTaskContext.MailboxProcessingState.Watermark.DocumentId.ToString(), storeSession.MailboxGuid, storeSession.MailboxOwner.MailboxInfo.DisplayName }); } result = null; } InferenceDataCollectionAssistant.PostInferenceDataCollectionProgressNotification(storeSession.MailboxGuid, processingResult.ToString()); if (processingResult == null) { InferenceDataCollectionAssistant.PostInferenceDataCollectionSuccessNotification(storeSession.MailboxGuid); } return(result); }