protected override void OnSetupMessageQueue() { ServiceMQ serviceMQ = (ServiceMQ)getServiceByName(CoreDaemonService.SERVICE_ID_MQ); if (serviceMQ != null) { serviceMQ.CreateServerControlQueue(callbackControlMessageHandler); serviceMQ.CreateStateQueue(callbackStateMessageHandler); } }
private async Task _InitializeServices() { ZoneGuardConfigContextFactory factory = new ZoneGuardConfigContextFactory(); using (ZoneGuardConfigContext context = factory.CreateDbContext()) { /*************************************************************** * * Load Services * ***************************************************************/ List <ThingDAL> services = await context.Thing .Where <ThingDAL>(t => t.ThingType == ThingType.Service) .Include(p => p.Parameters) .ToListAsync <ThingDAL>(); foreach (ThingDAL serviceDAL in services) { Console.WriteLine(serviceDAL.Name); ConfigService configService = ZoneGuardConfigContextFactory.CreateThingFromDAL <ConfigService>(serviceDAL); Console.WriteLine(configService.toJSON()); #if warning #endif //TODO:: MUST //TODOO:: MIGRATE addSensor(new SensorProxy(configSensor, this), false); ServiceCore service = null; String s = configService.ConfigClass; if (configService.ConfigClass == "ConfigServiceMQTT") { service = new ServiceMQTT((ConfigServiceMQTT)configService, this); } else if (configService.ConfigClass == "ConfigServiceMQ") { service = new ServiceMQ((ConfigServiceMQ)configService, this); } if (service != null) { addService(service); } else { Logger.LogWarning("Service '{0}' not created.", configService.Id); } } } }
public void PublishSensorState(SensorStateMessage ssm) { ServiceMQ.Publish(ServiceMQ.EXCHANGE_STATE, "", ssm.toJSON()); }