示例#1
0
        public bool StartNewJob(DeviceId deviceId, MessageReply reply)
        {
            reply.CreatedAt = DateTimeOffset.Now;
            _amqpService.SendMessage("RuleEngine", "Job", reply);

            return(true);
        }
示例#2
0
        private bool OnMessage(Message message)
        {
            var messageBodyObj = AmqpUtils.DeserializeMessage(message.Body);

            if (messageBodyObj == null)
            {
                throw new Exception("Could not deserialize message");
            }

            try
            {
                switch (message.Properties.Subject)
                {
                case "PutResource":
                {
                    var data     = messageBodyObj["body"].ToObject <string>();
                    var hashCode = Hash64Str(data);
                    _amqpService.SendMessage(message.Properties.ReplyTo,
                                             message.Properties.Subject,
                                             new { responseObject = new { hash = hashCode, uuid = Guid.NewGuid() } }, message.Properties.CorrelationId);
                    break;
                }

                default:
                    throw new NotImplementedException();
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(true);
        }