Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set routing key to None in eiffellib #11

Merged
merged 2 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ graphql-core==2.2.1
gql==0.1.0
cryptography==3.1
redis==3.5.3
eiffellib==1.2.0
eiffellib[rabbitmq]==2.2.0
pydantic==1.6
python-box==5.2.0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ install_requires =
gql==0.1.0
cryptography==3.1
redis==3.5.3
eiffellib==1.2.0
eiffellib[rabbitmq]==2.2.0
pydantic==1.6
requests==2.24.0
kubernetes==7.0.1
Expand Down
9 changes: 6 additions & 3 deletions src/etos_lib/etos.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ class ETOS: # pylint: disable=too-many-instance-attributes
__secrets = None
__database = None

def __init__(self, service_name, host, name):
def __init__(self, service_name, host, name, domain_id=None):
"""Initialize source and service name."""
self.config.set("source", {"name": name, "host": host})
source = {"name": name, "host": host}
if domain_id is not None:
source["domainId"] = domain_id
self.config.set("source", source)
self.config.set("service_name", service_name)

def __del__(self):
Expand All @@ -64,7 +67,7 @@ def start_publisher(self):
rabbitmq = self.config.get("rabbitmq_publisher")
if not rabbitmq:
raise PublisherConfigurationMissing
self.publisher = RabbitMQPublisher(**rabbitmq)
self.publisher = RabbitMQPublisher(routing_key=None, **rabbitmq)
if not self.debug.disable_sending_events:
self.publisher.start()
self.config.set("publisher", self.publisher)
Expand Down
5 changes: 4 additions & 1 deletion src/etos_lib/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def rabbitmq_subscriber_from_environment(self):
"""Load RabbitMQ subscriber data from environment variables and set in config."""
if not self.get("rabbitmq"):
self.rabbitmq_from_environment()
data = {"queue": os.getenv("RABBITMQ_QUEUE", None), "routing_key": "#"}
data = {
"queue": os.getenv("RABBITMQ_QUEUE", None),
"routing_key": os.getenv("RABBITMQ_ROUTING_KEY", "#")
}
data.update(**self.get("rabbitmq").copy())
self.set("rabbitmq_subscriber", data)

Expand Down