Пример #1
0
            public static void AddSentMessage(IIdentity identity, IMessage message)
            {
                string from = message.GetSenderId();
                string to   = identity.Id;

                SentMessagesCounter.Increment(1, new[] { from, to });
            }
Пример #2
0
 public Task OnDesiredPropertyUpdates(IMessage desiredProperties)
 {
     desiredProperties.SystemProperties[SystemProperties.OutboundUri] =
         Constants.OutboundUriTwinDesiredPropertyUpdate;
     this.channel.Handle(this.messageConverter.FromMessage(desiredProperties));
     Events.SentDesiredPropertyUpdate(this.Identity);
     return(Task.FromResult(true));
 }
Пример #3
0
        public Task SendC2DMessageAsync(IMessage message)
        {
            message.SystemProperties[TemplateParameters.DeviceIdTemplateParam] = this.Identity.Id;
            message.SystemProperties[SystemProperties.OutboundUri]             = Constants.OutboundUriC2D;
            IProtocolGatewayMessage pgMessage = this.messageConverter.FromMessage(message);

            this.channel.Handle(pgMessage);
            Events.SendMessage(this.Identity);
            return(Task.FromResult(true));
        }
Пример #4
0
        public Task SendTwinUpdate(IMessage twin)
        {
            twin.SystemProperties[SystemProperties.LockToken]   = Constants.TwinLockToken;
            twin.SystemProperties[SystemProperties.OutboundUri] = Constants.OutboundUriTwinEndpoint;
            IProtocolGatewayMessage pgMessage = this.messageConverter.FromMessage(twin);

            this.channel.Handle(pgMessage);
            Events.SentTwinUpdateToDevice(this.Identity);
            return(Task.CompletedTask);
        }
Пример #5
0
            public static void AddSentMessage(IIdentity identity, IMessage message)
            {
                string from = message.GetSenderId();
                string to   = identity.Id;

                string fromRouteOutput = message.GetOutput();
                string toRouteInput    = message.GetInput();

                SentMessagesCounter.Increment(1, new[] { from, to, fromRouteOutput, toRouteInput });
            }
Пример #6
0
            public static void AddSentMessage(IIdentity identity, IMessage message)
            {
                string from = message.GetSenderId();
                string to   = identity.Id;

                string fromRouteOutput = message.GetOutput();
                string toRouteInput    = message.GetInput();
                string priority        = message.ProcessedPriority.ToString();

                SentMessagesCounter.Increment(1, new[] { from, to, fromRouteOutput, toRouteInput, priority, bool.TrueString });
            }
Пример #7
0
        public Task SendMessageAsync(IMessage message, string input)
        {
            bool result = false;

            if (this.Identity is IModuleIdentity moduleIdentity)
            {
                message.SystemProperties[TemplateParameters.DeviceIdTemplateParam] = moduleIdentity.DeviceId;
                message.SystemProperties[Constants.ModuleIdTemplateParameter]      = moduleIdentity.ModuleId;
                message.SystemProperties[SystemProperties.InputName]   = input;
                message.SystemProperties[SystemProperties.OutboundUri] = Constants.OutboundUriModuleEndpoint;
                IProtocolGatewayMessage pgMessage = this.messageConverter.FromMessage(message);
                this.channel.Handle(pgMessage);
                result = true;
            }

            return(Task.FromResult(result));
        }
Пример #8
0
 public MqttFeedbackMessage(HubMessage message, FeedbackStatus status)
 {
     this.message        = message;
     this.FeedbackStatus = status;
 }