Since there was multiple people interested in this I created a more sophisticated example than I had original planned. Some of the functionality will be folded into the broker / broker client to make this transparent in the future.
I created a class called StatefulSocket. This class creates a session service using the DefaultSessionService service. The StatefulSocket creates a soft sticky connection to a particular service that is valid as long as there is an active RSocket connection. It uses an API available in the Netifi Broker that will notify you when a destination leaves. If either the client or service are discounted, or the StatefulSocket is closed the session is closed. Each StatefulSession has a sessionId that is unique, and be used to tie items in the session. The StatefulSocket acts like a normal RSocket and you can pass it to RSocket-RPC client etc. All requests from the StateSocket will go to the destination that it’s tied with for the socket’s lifetime.
To get the demo to work right now you need to build the netifi-java develop branch locally. Here’s the branch:
We’ve been moving some things around with our builds - I will send information to a repository with a snapshot when it’s available. Here’s a link to the to the example:
Let me know if you have any questions.