mirror of
https://github.com/ail-project/ail-framework.git
synced 2025-01-31 14:36:15 +00:00
fix subscriber names, update default config
This commit is contained in:
parent
2485ba5df2
commit
a68f5b6a0e
7 changed files with 11 additions and 9 deletions
|
@ -30,6 +30,7 @@ class Redis_Queues(object):
|
||||||
self.subscriber_name = subscriber_name
|
self.subscriber_name = subscriber_name
|
||||||
|
|
||||||
self.sub_channel = self.config.get(conf_section, conf_channel)
|
self.sub_channel = self.config.get(conf_section, conf_channel)
|
||||||
|
self.redis_channel = self.sub_channel + self.subscriber_name
|
||||||
|
|
||||||
# Redis Queue
|
# Redis Queue
|
||||||
config_section = "Redis_Queues"
|
config_section = "Redis_Queues"
|
||||||
|
@ -61,7 +62,7 @@ class Redis_Queues(object):
|
||||||
self.pub_socket.send('{} {}'.format(self.pub_channel, msg))
|
self.pub_socket.send('{} {}'.format(self.pub_channel, msg))
|
||||||
|
|
||||||
def redis_rpop(self):
|
def redis_rpop(self):
|
||||||
return self.r_queues.rpop(self.sub_channel + self.subscriber_name)
|
return self.r_queues.rpop(self.redis_channel)
|
||||||
|
|
||||||
def redis_queue_shutdown(self, is_queue=False):
|
def redis_queue_shutdown(self, is_queue=False):
|
||||||
if is_queue:
|
if is_queue:
|
||||||
|
@ -72,7 +73,6 @@ class Redis_Queues(object):
|
||||||
return self.r_queues.srem('SHUTDOWN_FLAGS', flag)
|
return self.r_queues.srem('SHUTDOWN_FLAGS', flag)
|
||||||
|
|
||||||
def redis_queue_subscribe(self, publisher):
|
def redis_queue_subscribe(self, publisher):
|
||||||
self.redis_channel = self.sub_channel + self.subscriber_name
|
|
||||||
publisher.info("Suscribed to channel {}".format(self.sub_channel))
|
publisher.info("Suscribed to channel {}".format(self.sub_channel))
|
||||||
while True:
|
while True:
|
||||||
msg = self.sub_socket.recv()
|
msg = self.sub_socket.recv()
|
||||||
|
|
|
@ -50,13 +50,12 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
config_section = 'PubSub_Words'
|
config_section = 'PubSub_Words'
|
||||||
config_channel = 'channel_0'
|
config_channel = 'channel_0'
|
||||||
subscriber_name = 'pubcateg'
|
subscriber_name = 'categ'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
|
|
||||||
# Publisher
|
# Publisher
|
||||||
pub_config_section = 'PubSub_Categ'
|
pub_config_section = 'PubSub_Categ'
|
||||||
|
|
||||||
h.zmq_pub(pub_config_section, None)
|
h.zmq_pub(pub_config_section, None)
|
||||||
|
|
||||||
# SCRIPT PARSER #
|
# SCRIPT PARSER #
|
||||||
|
|
|
@ -11,7 +11,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
config_section = 'PubSub_Categ'
|
config_section = 'PubSub_Categ'
|
||||||
config_channel = 'channel_0'
|
config_channel = 'channel_0'
|
||||||
subscriber_name = 'creditcard_categ'
|
subscriber_name = 'cards'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
h.zmq_sub(config_section)
|
||||||
|
|
|
@ -10,7 +10,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
config_section = 'PubSub_Categ'
|
config_section = 'PubSub_Categ'
|
||||||
config_channel = 'channel_1'
|
config_channel = 'channel_1'
|
||||||
subscriber_name = 'mails_categ'
|
subscriber_name = 'emails'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
h.zmq_sub(config_section)
|
||||||
|
|
|
@ -27,7 +27,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
config_section = 'PubSub_Categ'
|
config_section = 'PubSub_Categ'
|
||||||
config_channel = 'channel_2'
|
config_channel = 'channel_2'
|
||||||
subscriber_name = 'onion_categ'
|
subscriber_name = 'tor'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
h.zmq_sub(config_section)
|
||||||
|
|
|
@ -11,7 +11,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
config_section = 'PubSub_Categ'
|
config_section = 'PubSub_Categ'
|
||||||
config_channel = 'channel_3'
|
config_channel = 'channel_3'
|
||||||
subscriber_name = 'web_categ'
|
subscriber_name = 'urls'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
h.zmq_sub(config_section)
|
||||||
|
|
|
@ -56,7 +56,10 @@ channel_0 = words
|
||||||
|
|
||||||
[PubSub_Categ]
|
[PubSub_Categ]
|
||||||
adress = tcp://127.0.0.1:5003
|
adress = tcp://127.0.0.1:5003
|
||||||
#Channels are dynamic (1 channel per categ)
|
channel_0 = creditcard_categ
|
||||||
|
channel_1 = mails_categ
|
||||||
|
channel_2 = onion_categ
|
||||||
|
channel_3 = web_categ
|
||||||
|
|
||||||
[PubSub_Url]
|
[PubSub_Url]
|
||||||
adress = tcp://127.0.0.1:5004
|
adress = tcp://127.0.0.1:5004
|
||||||
|
|
Loading…
Add table
Reference in a new issue