Exemple #1
0
 private Task ProcessMessagesAsync(Message arg1, CancellationToken arg2)
 {
     return(Task.Run(() =>
     {
         var msg = AzureInboundMessage <TContent> .LoadFromBrokeredMessage(arg1, this.options.SubscriptionType, this.serializer, this.subscriptionClient);
         MessageReceived?.Invoke(this, new MessagedReceivedArguments <TContent> {
             Message = msg, ProcessMessageNumber = ++ProcessMessageNumber, ReceivedTimestamp = DateTimeOffset.UtcNow
         });
     }));
 }
Exemple #2
0
        internal static AzureInboundMessage <TContent> LoadFromBrokeredMessage(Microsoft.Azure.ServiceBus.Message inboundMessage,
                                                                               SubscriptionType subscriptioType, IMessageSerializer serializer, Microsoft.Azure.ServiceBus.SubscriptionClient subscription)
        {
            var content = serializer.Deserialize <TContent>(inboundMessage.Body);

            var msg = new AzureInboundMessage <TContent>
            {
                innerMessage      = inboundMessage,
                azureSubscription = subscription,
                Content           = content,
                subscriptionIsReceiveAndDelete = subscriptioType == SubscriptionType.ReceiveAndDelete,
                //This probably isnt necessary
                CorrelationId = inboundMessage.CorrelationId,
                ReceivedTime  = DateTimeOffset.UtcNow,
                MessageId     = inboundMessage.MessageId,
            };

            return(msg);
        }