How does a Consumer know what Channel to use in a ChannelSet?
If you subcribe a Consumer in Flex, you need to assign a ChannelSet to the Consumer. In my case, I create a ChannelSet and then add a Channel to that ChannelSet.
Apparently, the added channel is the current channel of the ChannelSet. But what if I would add two Channels to the ChannelSet? Do I need to set the currentChannel before subcribing?
If there are two channels开发者_JAVA技巧 in the ChannelCet, and I trigger the login method on the ChannelSet, will both Channels be authenticated and connected?
The ChannelSet will use the Channel that was added first and fall back to the other channels in case a Channel cannot be reached. The currentChannel property is a read-only property that points to the channel currently in use.
Here's the info from the docs:
Regardless of clustering, if a Channel cannot connect or looses connectivity, the ChannelSet will advance to its next available Channel and attempt to reconnect. This allows the ChannelSet to hunt through Channels that use different protocols, ports, etc., in search of one that can connect to its endpoint successfully.
About logging in: calling login() on the ChannelSet will use the same linear lookup of Channels and will authenticate on the first Channel. If you add another channel, it will be added to the list of channels and if it needs to be used, the ChannelSet will authenticate on the new Channel as well (since the credentials are saved). At least, that is what I can deduct from looking at the code of ChannelSet in the Flex SDK.
精彩评论