Comments (6)
@linde12 I'm working on a post for RisingStack which will focus on hydra messaging using sendMessage and related functions. The article should be published around the end of this month. We'll let you know when that's available.
from hydra.
I am transfering this post to a new issue since I see the title of the issue and the actual substance are not the same.
from hydra.
Hi @linde12. I agree that a simple example project would be very helpful, and we'll be putting out some practical examples soon. In the meantime, I'd recommend checking out @cjus's tutorial if that isn't what brought you here.
You can definitely do some sort of RPC communication between services using sendMessage and sendReplyMessage - it's what we've been doing. Since all messages need to be JSON, I think it would be quite possible to use something like JSON RPC in the payload (body
field) of the UMFMessages, but we haven't needed to implemented anything this robust so far.
IMO, you shouldn't feel that all HydraExpress services are public APIs. You can limit their accessibility at the application-level with auth, or at the system-level with firewall rules. We're doing both, and have plans to make our Hydra Express auth service open source eventually. This service uses JSON Web Tokens, and is just a light wrapper around fwsp-jwt-auth that checks passwords against our user database, and injects relevant user-data into the issued JWT.
However, an HTTP API is sometimes overkill, and there may be no reason to introduce the overhead of HTTP communication when you can use Redis pub-sub messaging. This is particularly true if these APIs are exclusively being consumed by other Hydra services.
HTH!
from hydra.
@emadum Ah, yes i read that article. It was great and was what got me started. I see, but it's nothing that's built-in? To clarify what i want to do is something like this:
..., (req, res) => {
hydra.sendMessage({to: 'service', from: 'another_service', bdy: {msg: 'Hello'}}, function onResponse (response) {
res.send(response.bdy);
});
});
@cjus That would be great, it's an important topic so some clarification would be great.
Again, great looking project. Can't wait to get started! 👍
from hydra.
@linde12 here you basically need to use Hydra's hydra.on('message', function(message) {})
and hydra.sendMessage call. There's nothing yet to do this automatically. Join us on our [email protected] account to discuss this further with the team. Send me an email to [email protected] and I'll send you an invite.
from hydra.
@cjus Ah, i see! Sent you an email and closing this for now! Thanks!
from hydra.
Related Issues (20)
- _sendMessage may have a possible silent failure HOT 2
- _sendMessage should use _reject() HOT 2
- _checkServicePresence throws a reject although it says it will never do so HOT 2
- Opinion: _checkServicePresence should not shuffle resultant array HOT 8
- Various improvements possible in mocha test cases HOT 2
- A warning about storing application data in the same Redis db as Hydra metadata HOT 3
- Run in browser? HOT 11
- Pattern matching HOT 10
- Nodejs crashes when redis connection dies - How to handle it ? HOT 1
- sendMessage() callback functionality HOT 2
- Init hydra again after shutdown
- Redis streams? HOT 2
- Disable redis connection HOT 2
- Documentation - init object
- Documentation website is down https://www.hydramicroservice.com
- Hydra on kubernetes is not working well with redis cluster mode or master-slave mode
- Ignoring logging of configured url path
- Is this project still active? HOT 9
- Dependancy upgrades required to mitigate vulnerability
- sendReplyMessage to sender instance HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hydra.