2

I have a system made of 12 windows services, say A, B ... M. They only exchange information via a queue (MSMQ in this case). The system works in linear fashion - an external party calls A, which publishes a message on a queue that B consumes. The format of the output is fixed, say AResult. B reads AResult, does some processing and publishes BResult to service C, etc.

The problem I'm running into now is that services down the pipeline need data not supplied by the previous step. E.g. service F needs properties from BResult.

I've considered a few alternatives, but they all have shortcomings:

  1. Pass a dictionary of all previous results along. That way say F will be able to read AResult, BResult, etc. The problem is this will introduce high coupling, any change anywhere can break other services.

  2. Have a global God object that different services populate. I've done something similar before and it ended very complex.

  3. Maintain a special object of the most useful data and pass it along each result. E.g. D receives CResult and GlobalContextData and publishes DResult and GlobalContextData. The problem is deciding to include in the context and maintaining it.

  • 1
    so whats the question? – D. Ben Knoble May 27 '15 at 19:35
  • 2
    Does this question belong here? This is not a programming question, this is a design question. – Quality Catalyst May 27 '15 at 19:36
  • What is a good solution for sharing data between these services? – RoyalAirForce May 27 '15 at 19:37
  • Quality Catalyst probably shares the opinion of some managers that programming is mostly typing :) – RoyalAirForce May 27 '15 at 19:38
  • 1
    Queues usually support pub/sub where one message type can be subscribed by multiple consumers. Take a look at msmq multicast. Alternatively, take a look at another queue services, RabbitMQ for example, they have so called fanout exchanges where one message is delivered to multiple queues. – Wiktor Zychla May 27 '15 at 19:39
  • I need the services to run linearly, e.g. C can't work without BResult at all. – RoyalAirForce May 27 '15 at 19:40
  • 1
    @RoyalAirForce, Quality Catalyst probably shares the opinion of the SO guidelines that questions are generally meant to be at the implementation level and not too broad or open-ended. – a p May 27 '15 at 19:41
  • How is this too broad, I'm looking for a concrete solution for my problem. – RoyalAirForce May 27 '15 at 19:43
  • @RoyalAirForce: I gave you a concrete solution. – Wiktor Zychla May 27 '15 at 19:44
  • Wiktor, I know RabbitMQ very well. You don't need fanout exchanges, a topic exchange can deliver a message to multiple queues as well. But that has nothing to do with my problem. I can't call F before A, B, C, D and E have finished processing the request. – RoyalAirForce May 27 '15 at 19:47
  • @RoyalAirForce I don't necessarily agree with the sentiment, but the idea is that architecture/design questions are necessarily of a what-should-I-do format, rather than a specific how-do-I format; this is necessarily open ended and allows opinionated or spammy responses to creep in (favorite libraries, philosophies, etc). – a p May 27 '15 at 19:52
  • @RoyalAirForce It is not bad or completely off-topic question, just that its abstract design level will probably be a better fit for http://programmers.stackexchange.com/ scope. – Eugene Podskal May 27 '15 at 20:07

0 Answers0