Message pipeline scheme

I have a set of services (not WCF) that queue. When a message arrives, a typical service performs some calculations and spills out zero or more result messages into the output queue. In addition to its main function, each service has some housekeeping logic, such as out-of-service / audit / logging / status monitoring with precise steps and sequence, slightly different between services. This is where the concept of conveyor enters the picture.

I am not satisfied with the design we are in, and am looking for ways to simplify it. Should I simulate CCR ports? ASP.NET pipeline? AOP? Anything else?

My current project is as follows: I have an interface IMessageHandler<TMessage>and about 15 implementations that are combined in 6 unique ways using IoC. The interface defines one Handle method (TMessage msg), so each implementation can execute some logic both before and after passing the message to the next handler in the sequence chain.

The problem is this: it is difficult to remember what exactly each implementation does and why they were tied in this way to this particular service. On the other hand, the presence of each aspect in its class makes it possible to better understand the problems and, therefore, simplify unit testing.

Ideas? Any good piping schemes that I can look at? Any good pipeline implementations that I can use as a reference? Or should I JFHCI ?

+3
source share
2 answers

I use the design you have chosen quite often, not always with IoC.

It looks like you have a problem with the documentation. This code does not help explain what it does. I see a couple of solutions to this problem.

Firstly, you can strongly comment on your code. This is often a smell and largely depends on the implementation. You can also comment by assigning your IoC configurations in a specific way.

-, . , , , , , "AuthorizeAndAudit", (, IoC " " , , ). . IMessageHandler, IMessageHandler foreach .

-, . , , , , . ( ) , .. . ( Auth then Audit ..), ( ) . , , , .

, , , Windows .

+2

, , . , " ", , , , .

, Java, : http://www.jmock.org/oopsla2006.pdf. # Algol " ", , , , .. .

+2

Source: https://habr.com/ru/post/1711519/


All Articles