public FolderMailboxManager(ExchangeService connection, string incomingFolder, IMessagePostProcessor postProcessor, bool useConversationGuidOnly) { _service = connection; _mailFolder = incomingFolder; _postProcessor = postProcessor; _useConversationGuidOnly = useConversationGuidOnly; }
public RecipientsMailboxManager(RecipientsMailboxManagerRouter router, IEnumerable<string> recipients, IMessagePostProcessor postProcessor) { _router = router; _postProcessor = postProcessor; _clientId = _router.RegisterMailbox(m => ShouldConsiderMessage(m, recipients.ToArray())); }
public RecipientsMailboxManager(RecipientsMailboxManagerRouter router, IEnumerable <string> recipients, IMessagePostProcessor postProcessor) { _router = router; _postProcessor = postProcessor; _clientId = _router.RegisterMailbox(m => ShouldConsiderMessage(m, recipients.ToArray())); }
public FolderMailboxManager(ExchangeService connection, string incomingFolder, IMessagePostProcessor postProcessor, bool useConversationGuidOnly, IEnumerable <string> recipients = null) { _service = connection; _mailFolder = incomingFolder; _postProcessor = postProcessor; _useConversationGuidOnly = useConversationGuidOnly; _recipients = recipients; }
public virtual bool RemoveAfterReceivePostProcessor(IMessagePostProcessor afterReceivePostProcessor) { if (afterReceivePostProcessor == null) { throw new ArgumentNullException(nameof(afterReceivePostProcessor)); } var current = AfterReceivePostProcessors; if (current != null && current.Contains(afterReceivePostProcessor)) { var copy = new List <IMessagePostProcessor>(current); copy.Remove(afterReceivePostProcessor); AfterReceivePostProcessors = copy; return(true); } return(false); }
/// <summary> Send the given object to the default destination, converting the object /// to a EMS message with a configured IMessageConverter. The IMessagePostProcessor /// callback allows for modification of the message after conversion. /// <p>This will only work with a default destination specified!</p> /// </summary> /// <param name="message">the object to convert to a message /// </param> /// <param name="postProcessor">the callback to modify the message /// </param> /// <exception cref="EMSException">If there is any problem accessing the EMS API</exception> public void ConvertAndSend(object message, IMessagePostProcessor postProcessor) { CheckDefaultDestination(); if (DefaultDestination != null) { ConvertAndSend(DefaultDestination, message, postProcessor); } else { ConvertAndSend(DefaultDestinationName, message, postProcessor); } }
public ConvertAndSendMessageCreator(EmsTemplate jmsTemplate, object message, IMessagePostProcessor messagePostProcessor) { this.jmsTemplate = jmsTemplate; objectToConvert = message; this.messagePostProcessor = messagePostProcessor; }
public virtual Task <T> ConvertSendAndReceiveAsync <T>(string destinationName, object request, IDictionary <string, object> headers, IMessagePostProcessor requestPostProcessor, CancellationToken cancellationToken = default) { var destination = ResolveDestination(destinationName); return(ConvertSendAndReceiveAsync <T>(destination, request, headers, requestPostProcessor, cancellationToken)); }
public virtual void ConvertAndSend(D destination, object payload, IDictionary <string, object> headers, IMessagePostProcessor postProcessor) { var message = DoConvert(payload, headers, postProcessor); Send(destination, message); }
public virtual void ConvertAndSend(object payload, IMessagePostProcessor postProcessor) { ConvertAndSend(RequiredDefaultSendDestination, payload, postProcessor); }
public virtual void ConvertAndSend <T>(string destinationName, T payload, IMessagePostProcessor postProcessor) { ConvertAndSend(destinationName, payload, null, postProcessor); }
public void AddDecompressor(string contentEncoding, IMessagePostProcessor decompressor) { this._decompressors[contentEncoding] = decompressor; }
public virtual async Task <T> ConvertSendAndReceiveAsync <T>(string destinationName, object request, IMessagePostProcessor requestPostProcessor, CancellationToken cancellationToken = default) { var destination = ResolveDestination(destinationName); return(await ConvertSendAndReceiveAsync <T>(destination, request, requestPostProcessor, cancellationToken)); }
public virtual async Task ConvertAndSendAsync <T>(string destinationName, T payload, IDictionary <string, object> headers, IMessagePostProcessor postProcessor, CancellationToken cancellationToken = default) { var destination = ResolveDestination(destinationName); await ConvertAndSendAsync(destination, payload, headers, postProcessor, cancellationToken); }
public virtual Task ConvertAndSendAsync <T>(string destinationName, T payload, IMessagePostProcessor postProcessor, CancellationToken cancellationToken = default) { return(ConvertAndSendAsync(destinationName, payload, null, postProcessor, cancellationToken)); }
public virtual T ConvertSendAndReceive <T>(string destinationName, object request, IDictionary <string, object> headers, IMessagePostProcessor requestPostProcessor) { var destination = ResolveDestination(destinationName); return(ConvertSendAndReceive <T>(destination, request, headers, requestPostProcessor)); }
public virtual void ConvertAndSend <T>(string destinationName, T payload, IDictionary <string, object> headers, IMessagePostProcessor postProcessor) { var destination = ResolveDestination(destinationName); ConvertAndSend(destination, payload, headers, postProcessor); }
/// <summary> Send the given object to the specified destination, converting the object /// to a EMS message with a configured IMessageConverter. The IMessagePostProcessor /// callback allows for modification of the message after conversion. /// </summary> /// <param name="destinationName">the name of the destination to send this message to /// (to be resolved to an actual destination by a DestinationResolver) /// </param> /// <param name="message">the object to convert to a message. /// </param> /// <param name="postProcessor">the callback to modify the message /// </param> /// <exception cref="EMSException">If there is any problem accessing the EMS API</exception> public void ConvertAndSend(string destinationName, object message, IMessagePostProcessor postProcessor) { CheckMessageConverter(); Send(destinationName, new ConvertAndSendMessageCreator(this, message, postProcessor)); }
public FolderMailboxManager(ExchangeService connection, string incomingFolder, IMessagePostProcessor postProcessor) { _service = connection; _mailFolder = incomingFolder; _postProcessor = postProcessor; }
public virtual Task ConvertAndSendAsync(D destination, object payload, IMessagePostProcessor postProcessor, CancellationToken cancellationToken = default) { return(ConvertAndSendAsync(destination, payload, null, postProcessor, cancellationToken)); }
public virtual Task <T> ConvertSendAndReceiveAsync <T>(D destination, object request, IMessagePostProcessor requestPostProcessor, CancellationToken cancellationToken = default) { return(ConvertSendAndReceiveAsync <T>(destination, request, null, requestPostProcessor, cancellationToken)); }
public FolderMailboxManager(ExchangeService connection, string incomingFolder, IMessagePostProcessor postProcessor) { _service = connection; _mailFolder = incomingFolder; _postProcessor = postProcessor; }
public virtual Task ConvertAndSendAsync(object payload, IMessagePostProcessor postProcessor, CancellationToken cancellationToken = default) { return(ConvertAndSendAsync(RequiredDefaultSendDestination, payload, postProcessor, cancellationToken)); }
public virtual async Task <T> ConvertSendAndReceiveAsync <T>(D destination, object request, IDictionary <string, object> headers, IMessagePostProcessor requestPostProcessor, CancellationToken cancellationToken = default) { var requestMessage = DoConvert(request, headers, requestPostProcessor); var replyMessage = await SendAndReceiveAsync(destination, requestMessage); if (replyMessage != null) { return(MessageConverter.FromMessage <T>(replyMessage)); } return(await Task.FromResult(default(T))); }
public virtual Task ConvertAndSendAsync(D destination, object payload, IDictionary <string, object> headers, IMessagePostProcessor postProcessor, CancellationToken cancellationToken = default) { var message = DoConvert(payload, headers, postProcessor); return(SendAsync(destination, message, cancellationToken)); }
public virtual T ConvertSendAndReceive <T>(object request, IMessagePostProcessor requestPostProcessor) { return(ConvertSendAndReceive <T>(RequiredDefaultDestination, request, requestPostProcessor)); }
public virtual void ConvertAndSend(D destination, object payload, IMessagePostProcessor postProcessor) { ConvertAndSend(destination, payload, null, postProcessor); }
public virtual T ConvertSendAndReceive <T>(D destination, object request, IMessagePostProcessor requestPostProcessor) { return(ConvertSendAndReceive <T>(destination, request, null, requestPostProcessor)); }
public virtual T ConvertSendAndReceive <T>(D destination, object request, IDictionary <string, object> headers, IMessagePostProcessor requestPostProcessor) { var requestMessage = DoConvert(request, headers, requestPostProcessor); var replyMessage = SendAndReceive(destination, requestMessage); if (replyMessage != null) { return(MessageConverter.FromMessage <T>(replyMessage)); } return(default);
protected virtual IMessage DoConvert(object payload, IDictionary <string, object> headers, IMessagePostProcessor postProcessor) { IMessageHeaders messageHeaders = null; object conversionHint = null; headers?.TryGetValue(CONVERSION_HINT_HEADER, out conversionHint); var headersToUse = ProcessHeadersToSend(headers); if (headersToUse != null) { if (headersToUse is MessageHeaders) { messageHeaders = (MessageHeaders)headersToUse; } else { messageHeaders = new MessageHeaders(headersToUse, null, null); } } var converter = MessageConverter; var message = converter is ISmartMessageConverter ? ((ISmartMessageConverter)converter).ToMessage(payload, messageHeaders, conversionHint) : converter.ToMessage(payload, messageHeaders); if (message == null) { var payloadType = payload.GetType().Name; object contentType = null; messageHeaders?.TryGetValue(MessageHeaders.CONTENT_TYPE, out contentType); contentType = contentType ?? "unknown"; throw new MessageConversionException("Unable to convert payload with type='" + payloadType + "', contentType='" + contentType + "', converter=[" + MessageConverter + "]"); } if (postProcessor != null) { message = postProcessor.PostProcessMessage(message); } return(message); }