1

I would like to find a solution to create a pub/sub medium for 2 microservices to talk to each other, I am aware i can use some third parties E.g Redis, RabbitMQ Implementing event-based communication between microservices (integration events)

The challenge lies on the client is unable to allow install any third parties tool due to security reason. The messageQueue server in Windows won't be allowed to use too. I can only use the applications that is only existed in the server.

Therefore i am asking if there is anyway that i can create one simple app using windows service. It is a one-to-many relationship. I have one service that will be dealing with data, once if there is any update, it will publish to those services that is subsribed to it.

It seems my problem could be similar with

.NET Scalable Pub/Sub service implementation

WCF Pub/Sub with subscriber caching(link is dead on the WCF pub-sub)

but i dont see any critical solutions.

I was thinking to use data notifications that MSSQL offers as last alternatives, but seems like it could cause a bottle neck when the applications get scale up. The internet is so much flooded with articles using third parties tool.

Thanks

csamleong
  • 769
  • 1
  • 11
  • 24
  • Where do these 2 microservices live? Both on the same pc? Are they two different applications? – Hasan Emrah Süngü Aug 30 '18 at 08:40
  • If it's only 2 applications then you just need a table (or two, for simplicity) to queue up published event information that gets removed as soon as it's handled. Pub/sub only really gets more complicated when you have different endpoints subscribing to different events. – Reinstate Monica Cellio Aug 30 '18 at 08:43
  • 1
    Are you sure the client want to pick "security" over "untested, potentially unreliable communications"? – Damien_The_Unbeliever Aug 30 '18 at 08:46
  • I've successfully implemented a queue-like communication with a table in SQL Server (you seem to suggest that is available). I only had one publisher and one consumer, so there was no issues with a queue message consumed twice. – trailmax Aug 30 '18 at 09:07
  • @EmrahSüngü yes, they are living in the same PC, yes, they are different apps. One responsible for data changes, and let the rest know. The other perform actions based on latest data. – csamleong Aug 30 '18 at 09:45
  • @Archer There are App1, and App2, the idea is App2 will be scaled to alot of App2 in the future. Will this method work if you may advice ? – csamleong Aug 30 '18 at 09:47
  • Do you mean multiple instances of app2, running on different machines? – Reinstate Monica Cellio Aug 30 '18 at 09:47
  • @Damien_The_Unbeliever I think the truth lies in, for financial related company, they need to go through a lot of hassles in order to have something new installed, if one can provide an app without the need to do that, they will just pick their product, and i tell them no, there is a ready-made tool out there, and i lost my business for unable to provide more convenience to them. – csamleong Aug 30 '18 at 09:50
  • @Archer nope, the first app2, is running on the same machine. But in the future, multiple instances could go to different machine. I hope to find a solution that is more agile. – csamleong Aug 30 '18 at 09:51
  • That's a "yes" then - there *will be* multiple instances of app2, running on different machines. You can't design this as anything other than what it will be or you're designing it to fail. Regardless, it can still all be done simply. Have you tried anything yourself, or just researched what's out there? – Reinstate Monica Cellio Aug 30 '18 at 09:52
  • Can we define what is included/excluded by the "third party tool" rule? E.g. NServiceBus is effectively a library that you can self host within your own applications, and has a SQL Server transport library available as well. There won't be any *installation* of any other products, just the fact that a few extra DLLs are now in your `bin` directory. – Damien_The_Unbeliever Aug 30 '18 at 09:55

1 Answers1

1

Check out Rebus library, that allows using different transport methods to send end receive messages in just a line of code (so in the future you can change it without effort).

You could use SQL Server or try to develop your own transport method

Martino Bordin
  • 1,412
  • 1
  • 14
  • 29
  • He says " the client is unable to allow install any third parties tool".. Rebus is not a tool to install..If he already has SQL Server he can use it otherwise he can leverage the library to develop his own transport method – Martino Bordin Aug 30 '18 at 08:52
  • Ah, yes. He seems to have MSSQL available ... sorry. – Fildor Aug 30 '18 at 09:01
  • @MartinoBordin thanks for your reply, it seems like no matter how i still need to resort to a medium for pub/sub ? Possible just to store the queue in my service's cache ? Say i have app1 as service, it can publish, app2 instances will just subcribe to it ? – csamleong Aug 30 '18 at 09:53
  • A medium is required for the communication. If you have 2 different apps they are running in their own AppDomain, so the cache are not accessible from outside. You should use a distributed cache otherwise (you cannot install). – Martino Bordin Aug 30 '18 at 10:13