views:

31

answers:

1

I'm trying to implement DDD application with layered architecture. I have:

  • Infrastructure layer - a layer which implements technology specific parts of the application.
  • Domain layer - a layer which contains domain model.
  • Application layer - a layer which contains interferences to interact with domain model.
  • And interfaces layer - a layer which receives events from the outside.

The classic 3 layer (+ infrastructure) architecture is quite clear. But my application isn't very classic. Beside UI I have scheduled task which should be ran periodically. I thought about putting such tasks into interfaces layer, because these task actually handle events like UI. But there is a problem, I can't make decision which layer I should put an scheduler which fire events for scheduled tasks.

I draw a sketch http://imgur.com/rY37b.png .

Which layer should I put the scheduler object? Or may be where is another way to design application with internal event generator.

A: 

To me, scheduler is a host for task executor (in the same way as your JSP container is a host for you UI). I would model it as an external entity and implement it as another infrastructure project.

Szymon Pobiega
Thanks, I get the same idea after I asked the question. You answer helps me to become sure.
jstingo