public Task Handle( HelloMessage message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { _logger.Info($"[MessageBusSample]: Message received: '{message.Text}'", this); return(Task.CompletedTask); }
public Task Handle( CreateDictionaryItemMessage message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { if (this.ValidateMessage(message)) { var database = Database.GetDatabase(message.Database); var language = LanguageManager.GetLanguage(message.Language); using (new DatabaseSwitcher(database)) using (new LanguageSwitcher(language)) { this.repository.CreateItem( message.DictionaryKey, message.DefaultValue, message.DictionaryDomainId, language, database); } } return(Task.CompletedTask); }
public async Task Handle(TestMessage message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { var messageBody = message.MessageBody; }
public Task Handle(Registration message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { this.repository.CreateItem(message); return(Task.CompletedTask); }
public async Task Handle(SubscribeContactMessage message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { Condition.Requires(message, "message").IsNotNull(); Condition.Requires(receiveContext, "receiveContext").IsNotNull(); Condition.Requires(replyContext, "replyContext").IsNotNull(); var configuredTaskAwaitable = _deferStrategy.ExecuteAsync(_bus, message, receiveContext, () => SubscribeContact(message)).ConfigureAwait(false); if (!(await configuredTaskAwaitable).Deferred) { _logger.LogDebug("[SubscribeContactMessageHandler] processed message.'"); } else { _logger.LogDebug("[SubscribeContactMessageHandler] deferred message."); } }
public async Task Handle([NotNull] UnsubscribeMessage message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { Condition.Requires(message, nameof(message)).IsNotNull(); Condition.Requires(receiveContext, nameof(receiveContext)).IsNotNull(); Condition.Requires(replyContext, nameof(replyContext)).IsNotNull(); DeferResult <HandlerResult> result = await _deferStrategy.ExecuteAsync( _bus, message, receiveContext, () => Unsubscribe(message)).ConfigureAwait(false); if (result.Deferred) { _logger.LogDebug($"[{nameof(UnsubscribeMessageHandler)}] defered message."); } else { _logger.LogDebug($"[{nameof(UnsubscribeMessageHandler)}] processed message.'"); } }
public async Task Handle(TestMessage message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { var deferResult = await this.deferStrategy .ExecuteAsync(this.bus, message, receiveContext, () => this.ProcessMessage(message)) .ConfigureAwait(false); if (deferResult.Deferred) { // deferred; } else { // handled } }
public Task Handle(SampleMessageContract message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { //Log the incoming message Sitecore.Diagnostics.Log.Info($"Message Received: {message.Message}, {message.Date}", this); // Implement your business logic return(Task.CompletedTask); }
/// <summary> /// Handles Contact Message and relay message through Hub /// </summary> /// <param name="contactMessage"></param> public Task Handle(ContactMessage message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { this._messageHub.Clients.All.BroadContacts(message); return(Task.CompletedTask); }
public Task Handle(SubmissionDataMessage message, IMessageReceiveContext receiveContext, IMessageReplyContext replyContext) { if (this.ValidateMessage(message)) { var formData = new FormSyncData { FormSubmissionEntry = new FormSubmissionEntry { FormEntry = message.FormEntry, FormSubmissionContext = new FormSubmissionContext { ContactId = message.ContactId } } }; _batchRuunner.RunVirtualBatch(message.FormEntry.FormItemId.ToString("N"), new IPlugin[] { formData }); //_batchRuunner.Run( // new ID(message.BatchId), new IPlugin[]{ formData }); } return(Task.CompletedTask); }