Skip to content

Commit

Permalink
Types definitons updates
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Nov 17, 2021
1 parent 74de7e4 commit 4b34bef
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion redisdb_exchange_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Redis DB exchange plugin
"""

__version__ = "0.2.2"
__version__ = "0.2.3"
10 changes: 7 additions & 3 deletions redisdb_exchange_plugin/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
# pylint: disable=no-value-for-parameter

# Library dependencies
from typing import Dict
import logging
from typing import Dict, Union
from exchange_plugin.publisher import Publisher as ExchangePublisher
from kink import di

Expand All @@ -32,9 +33,12 @@
from redisdb_exchange_plugin.publisher import Publisher


def create_container(settings: Dict) -> None:
def create_container(
settings: Dict[str, Union[str, int, None]],
logger: logging.Logger = logging.getLogger("dummy"),
) -> None:
"""Create Redis DB exchange plugin services"""
di[Logger] = Logger()
di[Logger] = Logger(logger=logger)
di["fb-redisdb-exchange-plugin_logger"] = di[Logger]

di[RedisClient] = RedisClient(
Expand Down
6 changes: 3 additions & 3 deletions redisdb_exchange_plugin/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Library dependencies
import json
import uuid
from typing import Dict, Optional
from typing import Dict, Optional, Union
from modules_metadata.routing import RoutingKey
from modules_metadata.types import ModuleOrigin
from redis import Redis
Expand Down Expand Up @@ -77,7 +77,7 @@ def __init__( # pylint: disable=too-many-arguments

def publish(self, origin: ModuleOrigin, routing_key: RoutingKey, data: Optional[Dict]) -> None:
"""Publish message to default exchange channel"""
message: dict = {
message = {
"routing_key": routing_key.value,
"origin": origin.value,
"sender_id": self.__identifier,
Expand Down Expand Up @@ -141,7 +141,7 @@ def receive(self) -> Optional[Dict]:
message = message.decode("utf-8")

try:
data: dict = json.loads(message)
data: Dict[str, Union[str, int, float, bool, None]] = json.loads(message)

# Ignore own messages
if (
Expand Down

0 comments on commit 4b34bef

Please sign in to comment.