Reputation: 165
I have an architecture based on micro services, netty io runs on a spring boot application, when I want to send a message to a client I have to wait for a message from the client to send the reply to the one I want to send. How could I send a message to the client without waiting for him to communicate with me? I'm lost in this step.
Upvotes: 3
Views: 3334
Reputation: 2968
You can process like that :
ctx.channel()
) channelInactive
event to remove the reference when the client disconnectsInstead of waiting for a HelloMessage, you can also catch the channelActive
event but it is fired each time somebody connects to your listened port, even if is not one of your client. That's why I prefer using an "Hello Message"
Now, you have a reference on the channel and you can send a message when you want by calling channel.writeAndFlush()
Upvotes: 7