I want to write a Java SE client application that talks to a Java server. Imagine something akin to an online game where there is a lot of traffic and potentially multiple clients connected to the same server.
- Constant communication between client and server
- Communication will be out of order, out of band so neither end knows nor expects what message it might receive next or when.
- The server doesn't know the client IP and cannot establish comms back to the client (because there may be NAT in the way). So any open ports must be initiated from the client side.
- Actual payload will be serialized bytes. I intend to use Protocol Buffers to marshal messages i开发者_开发技巧nto bytes onto the wire so that the transport envelope must be lightweight too.
- Client is Java SE, but potentially some day it could be C++.
ActiveMQ seems to be a suitable choice here but since I have never used it like this I am not sure if it has the performance or characteristics.
Can someone advise if it is suitable, what pitfalls I may encounter and perhaps suggest a tutorial which demonstrates something similar to what I am considering?
Yeah, I highly recommend ActiveMQ, it's fast, easy to install, it can handle all your requirements nicely. It's tight encoding option will really compress the message envelope size and it even supports a 'useCompression' option to compress the message bodies for you. It also has a nice C++ client
精彩评论