Esempio n. 1
0
 public MessageReceivingEventArgs(
     IMessageWrapper messageWrapper)
 {
     this.MessageWrapper = messageWrapper
                           ?? throw new ArgumentNullException(
                                     nameof(messageWrapper));
 }
Esempio n. 2
0
        public void Publish(IMessageWrapper messageWrapper)
        {
            var raw = _messageConverter.Serialize(messageWrapper.Message);

            if (raw == null)
            {
                return;
            }
            _rabbitMQWrapper.Publish(messageWrapper.Descriptor, raw);
        }
Esempio n. 3
0
        public void Publish(IMessageWrapper messageWrapper)
        {
            var messageBus = _iocResolver.Resolve <IMessageBus>();

            messageBus
            .OnMessageReceivedAsync(messageWrapper.Message, messageWrapper.Descriptor as IRichMessageDescriptor)
            .GetAwaiter()
            .GetResult()
            ;
        }
Esempio n. 4
0
        public async ValueTask PublishAsync(IMessageWrapper messageWrapper)
        {
            var raw = _messageConverter.Serialize(messageWrapper.Message);

            if (raw == null)
            {
                return;
            }
            await _rabbitMQWrapper.PublishAsync(messageWrapper.Descriptor, raw);
        }
Esempio n. 5
0
        public void Get(IMessageWrapper messageWrapper, string storeId, string entryId, string guid)
        {
            bool     itemHasMoved;
            string   newFolderPath;
            MailItem mailItem = GetMailItem(storeId, entryId, guid, out itemHasMoved, out newFolderPath);

            FillMessageWrapperFromMailItem(mailItem, messageWrapper);

            // We still have an instance of the task item
            _taskItem.Body = _taskItem.Body.Replace(messageWrapper.LinkLine, Utils.BuildMailItemLink(mailItem, newFolderPath, guid));
            //_taskItem.Session.Application.
        }
Esempio n. 6
0
        private static void FillMessageWrapperFromMailItem(MailItem mailItem, IMessageWrapper messageWrapper)
        {
            messageWrapper.Subject = mailItem.Subject;
            messageWrapper.Sender  = mailItem.SenderName;
            string body = Utils.RemoveHyperLinks(mailItem.Body);

            messageWrapper.Body = body;
            if (mailItem.Parent is Folder)
            {
                messageWrapper.StoreId = (mailItem.Parent as Folder).StoreID;
            }
            messageWrapper.EntryId = mailItem.EntryID;
        }
Esempio n. 7
0
 private void _taskPaneControl_MailClicked(IMessageWrapper messageWrapper)
 {
     try
     {
         MailItem mailItem2 = (MailItem)Application.Session.GetItemFromID(messageWrapper.EntryId, messageWrapper.StoreId);
         if (mailItem2 != null)
         {
             mailItem2.Display();
         }
     }
     catch (COMException)
     {
         // Swallow exception
     }
 }
Esempio n. 8
0
        private void Log(IMessageWrapper message, string tag)
        {
#if DEBUG
            System.Diagnostics.Debug
#else
            Console
#endif
            .WriteLine(string.Join("^",
                                   LEVEL_INFO,
                                   DateTimeOffset.UtcNow.ToString(),
                                   tag,
                                   message?.Topic ?? NULL,
                                   (message?.Timestamp)?.ToString() ?? NULL,
                                   message?.Message?.Replace("\r", "")?.Replace("\n", "") ?? NULL
                                   ));
        }
        public void Send(IMessageDestination destination, IMessageWrapper message,
            IMessageDestination responseDestination = null)
        {
            Logger.Debug(this, String.Format("{0}: Just sending message to {1} with correlation id {2}", this.ConnectionId, destination.Address,
                message.CorrelationId));
            IBasicProperties basicProperties = _session.Use.CreateBasicProperties();
            basicProperties.AppId = this.ConnectionId;
            basicProperties.CorrelationId = message.CorrelationId;
            if (responseDestination != null)
                basicProperties.ReplyTo = responseDestination.Address;
            _session.Use.BasicPublish(EXCHANGE_NAME, destination.Address,
                basicProperties, Formatter.Serialize(message.Content.ToString()));
            Logger.Debug(this, String.Format("{0}: Just sent message to {1} with correlation id {2}", this.ConnectionId, destination.Address,
                message.CorrelationId));

        }
Esempio n. 10
0
 public MessagesController(ICommandBus commandBus,
                           ILogger <MessagesController> logger,
                           IUserContext userContext,
                           IMessageDao messageDao,
                           IMessageWrapper messageWrapper,
                           ISubDao subDao,
                           IModerationDao moderationDao)
 {
     _commandBus     = commandBus;
     _logger         = logger;
     _userContext    = userContext;
     _messageDao     = messageDao;
     _messageWrapper = messageWrapper;
     _subDao         = subDao;
     _moderationDao  = moderationDao;
 }
Esempio n. 11
0
 public MessagesController(ICommandBus commandBus,
     ILogger<MessagesController> logger,
     IUserContext userContext,
     IMessageDao messageDao,
     IMessageWrapper messageWrapper,
     ISubDao subDao,
     IModerationDao moderationDao)
 {
     _commandBus = commandBus;
     _logger = logger;
     _userContext = userContext;
     _messageDao = messageDao;
     _messageWrapper = messageWrapper;
     _subDao = subDao;
     _moderationDao = moderationDao;
 }
 public void Send(IMessageDestination topicOrQueue, IMessageWrapper message,
                  Action<IIncomingMessage> responseHandler = null)
 {
     _senderChannelPool.UsingObjectFromPool(
     senderChannel =>
     {
         if (responseHandler != null)
         {
             _receiverChannelPool.ResponseProcessor.
                 AddSpecificResponseHandler(message.CorrelationId, responseHandler);
             senderChannel.Send(topicOrQueue, message, 
                 _receiverChannelPool.UniqueResponseDestination);
         }
         else
         {
             senderChannel.Send(topicOrQueue, message);
         }
     });
 }
Esempio n. 13
0
        public async Task SendAsync(IMessageWrapper message)
        {
            if (IsConnected)
            {
                var retMsg = await _producer.ProduceAsync(message.Topic,
                                                          //nameof( message.Message ),
                                                          null,
                                                          message.Message,
                                                          blockIfQueueFull : false).ConfigureAwait(false);

                if (retMsg.Error?.HasError == true)
                {
                    throw new InvalidOperationException(retMsg.Error.Reason);
                }
                return;
            }
            if (disposedValue)
            {
                throw new ObjectDisposedException(
                          nameof(_producer));
            }
            throw new InvalidOperationException(
                      "The Producer has not been initialized.");
        }
Esempio n. 14
0
 public virtual void LogReceive(IMessageWrapper message)
 {
     Log(message, RECV);
 }
Esempio n. 15
0
 public async ValueTask PublishAsync(IMessageWrapper messageWrapper)
 {
     await Task.Run(() => Publish(messageWrapper));
 }
Esempio n. 16
0
 public void Publish(IMessageWrapper messageWrapper)
 {
     PublishParameters.Add(messageWrapper);
 }
Esempio n. 17
0
 public ValueTask PublishAsync(IMessageWrapper messageWrapper)
 {
     PublishAsyncParameters.Add(messageWrapper);
     return(new ValueTask());
 }
Esempio n. 18
0
        public ValueTask PublishAsync(IMessageWrapper messageWrapper)
        {
            var messageBus = _iocResolver.Resolve <IMessageBus>();

            return(messageBus.OnMessageReceivedAsync(messageWrapper.Message, messageWrapper.Descriptor as IRichMessageDescriptor));
        }
Esempio n. 19
0
 public ValueTask PublishAsync(IMessageWrapper messageWrapper)
 {
     // No Actions.
     return(new ValueTask());
 }
Esempio n. 20
0
 public NotificationProcessor(IGlobalSettings globalSettings, IMessageWrapper messageWrapper)
 {
     _globalSettings = globalSettings;
     _messageWrapper = messageWrapper;
     _cancellationTokenSource = new CancellationTokenSource();
 }
Esempio n. 21
0
 public void Send(IMessageWrapper message)
 {
     //No actions.
 }
 public Task<IIncomingMessage> SendAsync(IMessageDestination topicOrQueue, 
     IMessageWrapper message)
 {
     throw new NotImplementedException();
 }
Esempio n. 23
0
 public void Publish(IMessageWrapper messageWrapper)
 {
     // No Actions.
 }