コード例 #1
0
from app.RabbitMqClient import RabbitMQ
from app.RuleServiceEvaluationImpl import RuleServiceEvaluation
import time
import random
import string

client_id = random_client_id = 'rule_subscriber'.join(
    random.choices(string.ascii_letters + string.digits, k=8))
service = RuleServiceEvaluation()
rabbitmq = RabbitMQ(client_id, service)
rabbitmq.start_connection()
rabbitmq.subscribe()

if __name__ == '__main__':
    while True:
        time.sleep(1)
コード例 #2
0
import time
from app.TimerServiceEvaluationImpl import TimerServiceEvaluation
from app.RabbitMqClient import RabbitMQ
import random
import string

client_id = random_client_id = 'timer_trigger'.join(random.choices(string.ascii_letters + string.digits, k=8))
rabbitmq = RabbitMQ(client_id)
rabbitmq.start_connection()
service = TimerServiceEvaluation(rabbitmq)

if __name__ == '__main__':
    while True:
        service.timer_trigger()
        time.sleep(3)
コード例 #3
0
from app.MQTTSubscriber import Subscriber
from app.ConsequentServiceEvaluationImpl import ConsequentServiceEvaluation
from app.RabbitMqClient import RabbitMQ
import time
import random
import string
from configuration.config import read_config
from app.RedisConnectionImpl import RedisConnection

client_id = random_client_id = 'consequent'.join(
    random.choices(string.ascii_letters + string.digits, k=8))

config = read_config()
redis = RedisConnection(config)
mqtt = Subscriber(client_id, config)
mqtt.start_connection()
consequent = ConsequentServiceEvaluation(config, redis)
rabbitmq = RabbitMQ(client_id, consequent, mqtt, config)
rabbitmq.start_connection()
rabbitmq.subscribe()

if __name__ == '__main__':
    while True:
        time.sleep(1)
コード例 #4
0
from app.RabbitMqClient import RabbitMQ
from app.MQTTSubscriber import Subscriber
import time
import random
import string
from configuration.config import read_config
from app.RedisConnectionImpl import RedisConnection
from app.DeviceInitializationImpl import DeviceInitialization
from app.MQTTSubscriberInitialization import SubscriberInitialization

client_id = 'device_entrypoint'.join(random.choices(string.ascii_letters + string.digits, k=8))
client_id_init = 'device_initialization'.join(random.choices(string.ascii_letters + string.digits, k=8))

config = read_config()
redis = RedisConnection(config)
rabbitmq = RabbitMQ(config)
rabbitmq.start_connection()

mqtt = Subscriber(config, client_id, rabbitmq)
mqtt.start_connection()
mqtt.subscribe()

service = DeviceInitialization(redis)
mqtt_initialization = SubscriberInitialization(config, client_id_init, service)
mqtt_initialization.start_connection()
mqtt_initialization.subscribe()

if __name__ == '__main__':
    while True:
        time.sleep(1)
コード例 #5
0
from app.MQTTSubscriber import Subscriber
from app.SwitchServiceEvaluationImpl import SwitchServiceEvaluation
from app.RabbitMqClient import RabbitMQ
import time
import random
import string
from configuration.config import read_config
from app.RedisConnectionImpl import RedisConnection

client_id = random_client_id = 'switch'.join(
    random.choices(string.ascii_letters + string.digits, k=8))

config = read_config()
redis = RedisConnection(config)
switch = SwitchServiceEvaluation(redis)
mqtt = Subscriber(client_id, switch)
mqtt.start_connection()
rabbitmq = RabbitMQ(client_id, switch, mqtt, config)
rabbitmq.start_connection()
rabbitmq.subscribe()

if __name__ == '__main__':
    while True:
        time.sleep(1)