Skip to content

Instantly share code, notes, and snippets.

@linead
Created February 19, 2015 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linead/198bd705549ec1b68768 to your computer and use it in GitHub Desktop.
Save linead/198bd705549ec1b68768 to your computer and use it in GitHub Desktop.
Netty Socket Client
I have a server Foo, that I connect to via a simple socket. I write text into the socket to send it messages and it replies with a response to my query once it's processed it, however it makes no guarantee of the order of responses. I can link up requests and responses with IDs.
Ex :
Send "1:request" to Foo
Foo Returns "1:response
Send "1:request" & "2:request" to Foo
Foo Returns "2:response"
10 seconds later
Foo Returns "1:response"
Question:
What's the best way to handle this situation with netty, how can I provide an interface that allows me to submit a message to the Foo service and give me a Promise or a Future that allows me to return without blocking waiting for the response to my message (but knowing i have an object that I can block on later)
Thanks!
@trustin
Copy link

trustin commented Feb 20, 2015

I think this is a great question that deserves a stack overflow question. Would you mind if I ask writing a question there?

@linead
Copy link
Author

linead commented Feb 20, 2015

Thanks Trustin
I did hesitate from posting this on stack overflow because I felt it might be a bit general, posted now. - http://stackoverflow.com/questions/28628023/asynchronous-application-design-with-netty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment