AMPS C# Client  5.3.5.0
AMPS C# Client for .NET
AMPS.Client.DefaultServerChooser Class Reference

A simple ServerChooser that keeps a list of AMPS instances and Authenticators, and advances to the next one when failure occurs. More...

+ Inheritance diagram for AMPS.Client.DefaultServerChooser:

Public Member Functions

 DefaultServerChooser ()
 Constructs a DefaultServerChooser instance with default settings. More...
 
virtual DefaultServerChooser add (string uri)
 Adds a URI to self. More...
 
virtual DefaultServerChooser addAll< T > (T uris)
 Adds URIs to self. More...
 
virtual string getCurrentURI ()
 Gets the current URI. More...
 
virtual Authenticator getCurrentAuthenticator ()
 Returns the Authenticator instance associated with the current URI. More...
 
virtual void reportFailure (Exception exception, ConnectionInfo ci)
 Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on. Implementors will likely advance the current URI to the next one in a list, or choose to stay with the current one, based on the exception type. More...
 
virtual void reportSuccess (ConnectionInfo ci)
 Handles the report of a successful connection. More...
 
virtual void next ()
 Moves to the next server in the list of URIs. More...
 
virtual String getError ()
 Provides additional details to be included in an exception thrown when the AMPS instance(s) are not available. Called by HAClient when creating an exception. More...
 

Detailed Description

A simple ServerChooser that keeps a list of AMPS instances and Authenticators, and advances to the next one when failure occurs.


// Create the client
HAClient client = new HAClient("CompositeSubber");
try
{
    // Add URIs and connect the client
    DefaultServerChooser sc = new DefaultServerChooser();
    sc.add("tcp://127.0.0.1:9027/amps/composite-json-binary");
    client.setServerChooser(sc);
    client.connectAndLogon();

Constructor & Destructor Documentation

◆ DefaultServerChooser()

AMPS.Client.DefaultServerChooser.DefaultServerChooser ( )
inline

Constructs a DefaultServerChooser instance with default settings.

Member Function Documentation

◆ add()

virtual DefaultServerChooser AMPS.Client.DefaultServerChooser.add ( string  uri)
inlinevirtual

Adds a URI to self.

Parameters
uriThe AMPS URI to add to the list.

◆ addAll< T >()

virtual DefaultServerChooser AMPS.Client.DefaultServerChooser.addAll< T > ( uris)
inlinevirtual

Adds URIs to self.

Parameters
urisThe AMPS URIs to add to the list.
Type Constraints
T :ICollection<String> 

◆ getCurrentAuthenticator()

virtual Authenticator AMPS.Client.DefaultServerChooser.getCurrentAuthenticator ( )
inlinevirtual

Returns the Authenticator instance associated with the current URI.

Returns
Returns an Authenticator or null if none is required for logon.

Implements AMPS.Client.ServerChooser.

◆ getCurrentURI()

virtual string AMPS.Client.DefaultServerChooser.getCurrentURI ( )
inlinevirtual

Gets the current URI.

Returns
The current URI.

Implements AMPS.Client.ServerChooser.

◆ getError()

virtual String AMPS.Client.DefaultServerChooser.getError ( )
inlinevirtual

Provides additional details to be included in an exception thrown when the AMPS instance(s) are not available. Called by HAClient when creating an exception.

Returns
A String with information about the connection that failed and the reason for the failure. When no further information is available, returns an empty string.

Implements AMPS.Client.ServerChooser.

◆ next()

virtual void AMPS.Client.DefaultServerChooser.next ( )
inlinevirtual

Moves to the next server in the list of URIs.

◆ reportFailure()

virtual void AMPS.Client.DefaultServerChooser.reportFailure ( Exception  exception,
ConnectionInfo  ci 
)
inlinevirtual

Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on. Implementors will likely advance the current URI to the next one in a list, or choose to stay with the current one, based on the exception type.

Parameters
exceptionThe exception associated with this failure.
ciInformation about the connection that failed.

Implements AMPS.Client.ServerChooser.

◆ reportSuccess()

virtual void AMPS.Client.DefaultServerChooser.reportSuccess ( ConnectionInfo  ci)
inlinevirtual

Handles the report of a successful connection.

Parameters
ciInformation about the successful connection.

Implements AMPS.Client.ServerChooser.


The documentation for this class was generated from the following file: