Show TOC

Procedure documentationServer Management Locate this document in the navigation structure

Procedure

The following class manages the connection parameters for all servers and allows the application runtime to shutdown all running servers at once. In analogy to destination management there are three mutually exclusive ways for an application to provide the connection parameters needed for starting an RFC server:

1. Provide the parameters during runtime (e.g. if you get them from a UI).

2. Define the parameters in the standard .NET configuration file of the executable

3. Implement and provide a configuration object, which the RfcServerManager can “ask”, whenever it needs logon parameters for a particular system. This configuration object can then do whatever it wants (e.g. lookup parameters in a central LDAP system or a database), as long as it comes up with the required parameters.

public class RfcServerManager

public static IServerConfiguration Configuration

If the application environment supplies an object of this type, .the .NET Connector will use it for obtaining all connection parameters for RFC servers. This can be set only once.

public static RfcServer CreateServer(String serverName, System.Type[] functionHandlers)

Creates the RfcServer corresponding to the given name, CreateServer(String, Type[]) throws RfcInternalError. In the functionHandlers array you can provide as many function module implementations, as you like. The types given here need to define one or more methods complying with the prototype RfcServer.FunctionHandler defined below. Each of these methods needs to be tagged with an Attribute of type RfcFunctionName. (See below.) If an RFC request for the function module ‘XYZ’ comes in from the backend, the .NET Connector searches for a method annotated with RfcFunctionName(“XYZ”) and executes it. If that method is static, it will just be executed, if it is an instance member, the .NET Connector will create a new instance of the object for each new server connection and keeps it for as long as the server connection is alive. (This is interesting in particular for stateful server connections.) If two or more methods (either in the same Type or in different Types) are tagged with the same function module name, CreateServer() will throw an RfcInternalError. Function module names need to be unique within one server. If one of the methods is tagged with RfcFunctionName(“*”), it acts as the “default function handler”, meaning the .NET Connector calls this implementation, whenever it receives a function module request, for which no explicit handler method can be found. You can use this feature for providing some kind of “fallback” for unexpected function modules, or for writing a single generic function handler that can serve all function calls. If you don’t provide a default function handler, the .NET Connector will abort all function calls for which it can’t find a handler, with a SYSTEM_FAILURE and the error message “No server function for function module ‘XYZ’”.

public static RfcServer CreateServer( Dictionary<String, String> parameters), System.Type[] functionHandlers)

Creates an RfcServer from the given connection parameters. If a Configuration object has already been installed, CreateServer(Dictionary, Type[]) throws RfcInternalError. For a documentation of the functionHandlers array see above.

public static void Start(String[] args)

This API is for starting an RFC server program as a Windows Service. (Does this really make sense? How would it work?)

public static void StartAll()

Starts all RfcServers that are currently in status STOPPING or STOPPED.

public static void StopAll(bool force) Stops all currently existing RfcServers.

The RfcServers stop listening, but they can be started again at later point. The force parameter specifies, whether this function should wait until all currently running RFC requests are finished processing (force=false) or whether the RfcServer should abort currently running requests and stop immediately.

public static void ShutdownAll(bool force)

Stops all currently existing RfcServers and releases the associated resources. The force parameter specifies, whether this function should wait until all currently running RFC requests are finished processing (force=false) or whether the RfcServers should abort currently running requests and stop immediately. Applications that want to use the “configuration approach” need to implement the following interface and then set an instance on the RfcDestinationManager during application startup. Alternatively, they can provide AssemblyName and TypeName of the implementation and the .NET Connector will try to load an instance of the given class from the Global Assembly Cache. This object then provides access to the application’s central RFC server configuration.

public interface IServerConfiguration

public static String AssemblyName

If you want the .NET Connector to automatically look for an implementation, provide the names of the assembly and of the type that should be attempted to load.

public static String TypeName

If you want the .NET Connector to automatically look for an implementation, provide the names of the assembly and of the type that should be attempted to load.

public Dictionary<String, String> GetParameters( String serverName)

This function needs to provide all connection parameters and technical configuration parameters necessary to register an RFC server at the given gateway.

public bool ChangeEventsSupported()

Your application needs to return true or false here, depending on whether your configuration object wants to support configuration change events.

public delegate void ConfigurationChangeHandler( String serverName, RfcConfigurationArgs args)

Applications can ignore this; it is used by the .NET Connector internally.

public event ConfigurationChangeHandler ConfigurationChanged

If your configuration object says it supports configuration change events, then the .NET connector will register a delegate of type ConfigurationChangeHandler for this event. Then whenever your application wants to change one or more connection parameters for a given RfcServer (e.g. using a different hostname or changing the number of parallel listening connections), it needs to trigger this event, and the .NET Connector will change the corresponding RfcServer object correspondingly.