Handler call Handler ... Is this possible?

29 views
Skip to first unread message

shapper

unread,
Mar 16, 2012, 7:21:56 PM3/16/12
to agath...@googlegroups.com
Hello,

I have 3 Handlers, let's say: BuildChartHandler, GetDataOneHandler and GetDataTwoHandler.
 
When I dispatch a BuildChartRequest I will receive a chart ... But I need to send the data.

Is it possible to "tell" to BuildChartHandler where to get the data?

Then BuildChartHandler would get the data from GetDataOneHandler or GetDataTwoHandler ...

My idea is send BuildChartRequest instead of sending a DataRequest and with it then call the BuildChartRequest ...

Does this make sense? It is something like cascade ...If i can call it that ...

Thank You,
Miguel

Davy Brion

unread,
Mar 19, 2012, 5:24:57 AM3/19/12
to agath...@googlegroups.com
you can inject handlers into other handlers if you want

though ideally, handlers contain as little logic as possible and delegate to other classes... which can then be reused in multiple handlers as well

shapper

unread,
Mar 19, 2012, 8:25:24 PM3/19/12
to agath...@googlegroups.com
Thank You,

I will follow your advice.

Cheers,
Miguel

nabils

unread,
Mar 29, 2012, 3:27:28 PM3/29/12
to agath...@googlegroups.com
Davy,

Is there any reason why you shouldn't put logic inside the handler as long as it is not shared with other handlers. I like to use the handler rather than creating massive service classes for logic.

Davy Brion

unread,
Mar 29, 2012, 5:18:31 PM3/29/12
to agath...@googlegroups.com
just a matter of personal preference i guess... i prefer to keep important logic outside of infrastructure related classes. And request handlers in Agatha are rather tightly coupled to the Agatha infrastructure.
Reply all
Reply to author
Forward
0 new messages