Skip to content

Commit

Permalink
Rename MemoryBroker to InlineBroker
Browse files Browse the repository at this point in the history
Also remove unused RQ Broker Adapter
  • Loading branch information
subhashb committed Sep 24, 2020
1 parent 4077b9f commit bec09c7
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from protean.utils import fully_qualified_name


class MemoryBroker(BaseBroker):
class InlineBroker(BaseBroker):
def __init__(self, name, domain, conn_info):
super().__init__(name, domain, conn_info)

# In case of `MemoryBroker`, the `IS_ASYNC` value will always be `False`.
# In case of `InlineBroker`, the `IS_ASYNC` value will always be `False`.
conn_info["IS_ASYNC"] = False

def send_message(self, initiator_obj):
Expand Down
2 changes: 1 addition & 1 deletion src/protean/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Domain(_PackageBoundObject):
},
"BROKERS": {
"default": {
"PROVIDER": "protean.adapters.broker.memory_broker.MemoryBroker",
"PROVIDER": "protean.adapters.broker.inline_broker.InlineBroker",
},
},
"EMAIL_PROVIDERS": {
Expand Down
2 changes: 1 addition & 1 deletion tests/adapters/email/sendgrid_email/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Messaging Mediums
BROKERS = {
"default": {"PROVIDER": "protean.adapters.broker.memory_broker.MemoryBroker"},
"default": {"PROVIDER": "protean.adapters.broker.inline_broker.InlineBroker"},
}

EMAIL_PROVIDERS = {
Expand Down
6 changes: 3 additions & 3 deletions tests/broker/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest

from protean.port.broker import BaseBroker
from protean.adapters.broker.memory_broker import MemoryBroker
from protean.adapters.broker.inline_broker import InlineBroker


class TestBroker:
Expand All @@ -11,10 +11,10 @@ def test_that_base_broker_class_cannot_be_instantiated(self):
BaseBroker()

def test_that_a_concrete_broker_can_be_initialized_successfully(self, test_domain):
broker = MemoryBroker("dummy_name", test_domain, {})
broker = InlineBroker("dummy_name", test_domain, {})

assert broker is not None

def test_that_domain_initializes_broker_from_config(self, test_domain):
assert len(list(test_domain.brokers)) == 1
assert isinstance(list(test_domain.brokers.values())[0], MemoryBroker)
assert isinstance(list(test_domain.brokers.values())[0], InlineBroker)
2 changes: 1 addition & 1 deletion tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

# Messaging Mediums
BROKERS = {
"default": {"PROVIDER": "protean.adapters.broker.memory_broker.MemoryBroker"},
"default": {"PROVIDER": "protean.adapters.broker.inline_broker.InlineBroker"},
}

EMAIL_PROVIDERS = {
Expand Down
2 changes: 1 addition & 1 deletion tests/configuration/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_config_repr(self):
"'IDENTITY_STRATEGY': <IdentityStrategy.UUID: 1>, "
"'IDENTITY_TYPE': <IdentityType.STRING: 'STRING'>, "
"'DATABASES': {'default': {'PROVIDER': 'protean.adapters.repository.memory.MemoryProvider'}}, "
"'BROKERS': {'default': {'PROVIDER': 'protean.adapters.broker.memory_broker.MemoryBroker'}}, "
"'BROKERS': {'default': {'PROVIDER': 'protean.adapters.broker.inline_broker.InlineBroker'}}, "
"'EMAIL_PROVIDERS': {'default': {'PROVIDER': 'protean.adapters.email.dummy.DummyEmailProvider', "
"'DEFAULT_FROM_EMAIL': '[email protected]'}}, "
"'AGGREGATE_CHILDREN_LIMIT': 100, "
Expand Down
4 changes: 2 additions & 2 deletions tests/domain_event/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from mock import patch
from protean.core.domain_event import BaseDomainEvent
from protean.globals import current_domain
from protean.adapters.broker.memory_broker import MemoryBroker
from protean.adapters.broker.inline_broker import InlineBroker
from protean.infra.event_log import EventLog, EventLogRepository
from protean.utils import fully_qualified_name

Expand Down Expand Up @@ -41,7 +41,7 @@ def special_method(self):


class TestDomainEventTriggering:
@patch.object(MemoryBroker, "send_message")
@patch.object(InlineBroker, "send_message")
def test_that_domain_event_is_raised_in_aggregate_command_method(self, mock):
newcomer = Person.add_newcomer(
{"first_name": "John", "last_name": "Doe", "age": 21}
Expand Down
2 changes: 1 addition & 1 deletion tests/identity/config_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@

# Messaging Mediums
BROKERS = {
"default": {"PROVIDER": "protean.adapters.broker.memory_broker.MemoryBroker"},
"default": {"PROVIDER": "protean.adapters.broker.inline_broker.InlineBroker"},
}
2 changes: 1 addition & 1 deletion tests/identity/config_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@

# Messaging Mediums
BROKERS = {
"default": {"PROVIDER": "protean.adapters.broker.memory_broker.MemoryBroker"},
"default": {"PROVIDER": "protean.adapters.broker.inline_broker.InlineBroker"},
}
2 changes: 1 addition & 1 deletion tests/identity/config_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@

# Messaging Mediums
BROKERS = {
"default": {"PROVIDER": "protean.adapters.broker.memory_broker.MemoryBroker"},
"default": {"PROVIDER": "protean.adapters.broker.inline_broker.InlineBroker"},
}

0 comments on commit bec09c7

Please sign in to comment.