public async Task <string> PublishMessageToMessageQueue(string topicName, object msgBody, Dictionary <string, string> messageAttribute) { try { var publisher = new InfrastructureService.MessageQueue.Publisher(_configuration, topicName); return(await publisher.PublishAsync(msgBody, messageAttribute)); } catch (Exception ex) { LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical)); throw; } }
/// <summary> /// Publishes the message to queue. /// </summary> /// <param name="source">The source.</param> /// <param name="messageBody">The message body.</param> /// <param name="subject">The subject.</param> /// <param name="topic">The topic.</param> /// <param name="messageAttribute">The message attribute.</param> /// <returns></returns> private async Task <string> PublishMessageToQueue(string source, string messageBody, string subject, string topic, string messageAttribute) { var configResponse = await GetValue(ConfiType.AWS.ToString()); List <Dictionary <string, string> > _result = ((List <Dictionary <string, string> >)configResponse.Results); var accessKey = _result.Single(x => x["key"] == "AWSAccessKey")["value"]; var secretKey = _result.Single(x => x["key"] == "AWSSecretKey")["value"]; var publisher = new InfrastructureService.MessageQueue.Publisher(accessKey, secretKey, topic); var messageDict = new Dictionary <string, string>(); messageDict.Add(EventTypeString.EventType, messageAttribute); return(await publisher.PublishAsync(messageBody, messageDict, subject)); }