DoclerLabs / hexMachina

Releases, issues, documentation, website of hexMachina, framework written in Haxe
http://hexmachina.org
MIT License
44 stars 8 forks source link

Remove add(dispatcher) if IStatefulService in MappingConfiguration #217

Closed aliokan closed 7 years ago

aliokan commented 7 years ago

This automatic feature create bad visibility to know who listen StatefulService.

Moreover, in the current develop branch, dispatch signatures are different between IStatefulService dispatcher and internal dispatcher in Module, and then CommandExecutor.

CompositeDispatcher ()

public function dispatch( messageType : MessageType, ?data : Array<Dynamic> ) : Void 

Module

function _dispatchPrivateMessage( messageType : MessageType, ?request : Request ) : Void 

CommandExecutor

public function executeCommand( mapping : ICommandMapping, ?request : Request, ?mappingRemoval : Void->ICommandMapping ) : Void

With this auto add handlers, we have no way to add an adapter between dispatcher and listener.

It will be clearer and cleaner to add service to listen node in Context.

<chat id="chat" type="hex.ioc.parser.xml.mock.MockChatModule">
     <listen ref="myService"/>
</chat>
aliokan commented 7 years ago

done with commit : DoclerLabs/hexInject@6429b5fe4ae9799fa8bfe090a99ff4afe719401f