DEV Community

Discussion on: Microservices and Enforced Modularity

Collapse
 
satishpatro44 profile image
satishpatro44

What to do if you want to call one service of different module?

Collapse
 
190245 profile image
Dave

Agree some type of API/RPC for the cross-service communication.

Better yet, setup an event bus. Both services emit events, both consume whatever events they're interested in.

Collapse
 
tonyhicks20 profile image
Tony Hicks

Yup... That would be part of your public interface that you'd expose. You would call it based on the communication mechanism appropriate to your needs.

Thread Thread
 
190245 profile image
Dave

I dislike exposing public interfaces (on the public internet). But sit it behind some network level security (e.g. whitelisted IP/range) and you're golden.

Event bus just means your service doesn't need to care about another services API (beyond being able to understand the events).

Good article btw.

Thread Thread
 
tonyhicks20 profile image
Tony Hicks

By "public interface" what I mean in this context is the functionality you would expose for other external services (from the same trusted system) to call. You're right though, you wouldn't want to expose a service directly to the internet. You'd use an API Gateway and expose that.