mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 09:57:37 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			322 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			322 B
		
	
	
	
		
			Python
		
	
	
	
	
	
"""Message bus module."""
 | 
						|
 | 
						|
from typing import Dict, Callable, Any
 | 
						|
 | 
						|
from .commands import Command
 | 
						|
 | 
						|
 | 
						|
class MessageBus:
 | 
						|
 | 
						|
    def __init__(self, command_handlers: Dict[str, Callable[..., Any]]):
 | 
						|
        self.command_handlers = command_handlers
 | 
						|
 | 
						|
    def handle(self, command: Command):
 | 
						|
        self.command_handlers[command]()
 |