Connectors

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Overview)
(added quicklinks)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Quicklinks}}
 +
<br />
 
==Overview==
 
==Overview==
  
There are up to 5 components involved in connecting simulator code to a grid service. These are
+
There are up to 5 components involved in connecting simulator code to a grid service. These are
  
 
{| border="1"
 
{| border="1"
!Component!!Description
+
!Component!!Location!!Description
 
|-
 
|-
| The simulator code itself || This references the data service.  This can be in OpenSim core or in a module.
+
| The simulator code itself || OpenSimulator core or a module || This initially references the service to get or set data.
 
|-
 
|-
| The simulator service connector || These are found in OpenSim/Region/CoreModules/ServiceConnectorsOut/ (for outbound connections) and ServiceConnectorsIn/ (for inbound connections)These connectors come in two flavours, local and remote.  The local connectors connect directly to the service and are used when caller and service are in the same process (as in the standalone configuration).  The remote connectors use the service connectors in OpenSim/Services/Connectors to make a call over the network to some remote process.
+
| The simulator service connector || OpenSim/Region/CoreModules/ServiceConnectorsOut (for outbound connections) and ServiceConnectorsIn (for inbound connections) || These connectors come in two flavours, local and remote.  The local connectors connect directly to the service and are used when caller and service are in the same process (as in the standalone configuration).  The remote connectors use the service connectors in OpenSim/Services/Connectors to make a call over the network to some remote process.
 
|-
 
|-
| The remote service connector || These are found in OpenSim/Services/Connectors, as stated above.  They actually marshal the data and make the appropriate call to a remote data service.  These are not used for in-process connections.
+
| The remote service connector || OpenSim/Services/Connectors || These do the work of actually marshalling the data and make the appropriate call to a remote data service.  These are not used for in-process connections.
 
|-
 
|-
| The remote service handler || These are found in OpenSim/Server/HandlersThese are not used for in-process connections.  These unpack the call received from a simulator connector and pass it on to the service itself.
+
| The remote service handler || OpenSim/Server/Handlers || These are not used for in-process connections.  These unpack the call received from a simulator connector and pass it on to the service itself.
 
|-
 
|-
| The service || Each major service has its own package (e.g. OpenSim/Services/AssetService). The service actually services the call and returns data to the caller, if applicable.
+
| The service || Each major service has its own package (e.g. OpenSim/Services/AssetService).|| The service actually services the call and returns data to the caller, if applicable.
 
|}
 
|}
  
==Example==
+
== Example ==
  
Let's take a look at the asset service. The asset service connector is available as the Scene.AssetService property in the Scene object (direct references aren't always available - sometimes the connector has to be requested via the Scene.RequestModuleInterface<Interface>() mechanism).
+
Let's take a look at the asset service. The asset service connector is available as the Scene.AssetService property in the Scene object (direct references aren't always available - sometimes the connector has to be requested via the Scene.RequestModuleInterface<Interface>() mechanism).
  
A caller executes the method Scene.AssetService.Get() to retrieve an asset synchronously.
+
A caller executes the method Scene.AssetService.Get() to retrieve an asset synchronously.  
  
Suppose first of all that we're running a standalone configuration where both simulator and service are in the same process. In this case, the simulator's call goes to the LocalAssetServiceConnector.Get(). This first checks the cache, and if the asset isn't found there, then calls AssetService.Get(). The AssetService retrieves the asset from persistent storage and passes it back to the simulator code.
+
Suppose first of all that we're running a standalone configuration where both simulator and service are in the same process. In this case, the simulator's call goes to the LocalAssetServiceConnector.Get(). This first checks the cache, and if the asset isn't found there, then calls AssetService.Get(). The AssetService retrieves the asset from persistent storage and passes it back to the simulator code.
  
Now let's suppose that we're running in a grid configuration, where the asset service is operating on some other machine. As before, the simulator code calls Scene.AssetService.Get(). This time, the call is routed to RemoteAssetServiceConnector.Get(), which in this case inherits from OpenSim/Services/Connectors/AssetServiceConnector.
+
Now let's suppose that we're running in a grid configuration, where the asset service is operating on some other machine. As before, the simulator code calls Scene.AssetService.Get(). This time, the call is routed to RemoteAssetServiceConnector.Get(), which in this case inherits from OpenSim/Services/Connectors/AssetServiceConnector.
  
 
AssetServiceConnector.Get() generates an HTTP call to http://yourassetserver/assets/assetId, where assetId is the id of the asset requested.
 
AssetServiceConnector.Get() generates an HTTP call to http://yourassetserver/assets/assetId, where assetId is the id of the asset requested.
  
This hops over the network and is handled by OpenSim/Server/Handlers/Asset/AssetServerConnector. It uses its own AssetServerGetHandler to unpack the HTTP request and call the AssetService to retrieve the data. If the asset is found, then it returns the asset as XML ready for the receiving AssetServiceConnector to unpack. If the asset is missing then it returns a 404 HTTP status code.
+
This hops over the network and is handled by OpenSim/Server/Handlers/Asset/AssetServerConnector. It uses its own AssetServerGetHandler to unpack the HTTP request and call the AssetService to retrieve the data. If the asset is found, then it returns the asset as XML ready for the receiving AssetServiceConnector to unpack. If the asset is missing then it returns a 404 HTTP status code.
  
==Configuration==
+
== Configuration ==
  
Connectors are configured in OpenSim configuration files. For standalone, the configuration is in bin/config-include/Standalone.ini. Standalone users never need to change this file. For grid users, the configuration is in bin/config-include/Grid.ini and GridCommon.ini. In the grid case, GridCommon.ini (after copying from GridCommon.ini.example) is where the user specifies the URLs for each grid service.
+
Connectors are configured in OpenSimulator configuration files. For standalone, the configuration is in bin/config-include/Standalone.ini. Standalone users never need to change this file. For grid users, the configuration is in bin/config-include/Grid.ini and GridCommon.ini. In the grid case, GridCommon.ini (after copying from GridCommon.ini.example) is where the user specifies the URLs for each grid service.
  
===Standalone===
+
=== Standalone ===
  
Let's look at Standalone.ini. You'll see that there is a Modules section with the lines
+
Let's look at Standalone.ini. You'll see that there is a Modules section with the lines
  
 
  [Modules]
 
  [Modules]
Line 45: Line 47:
 
     ...
 
     ...
  
This is where the connectors are specified for each service. As you can see, the asset service here is specified to use the LocalAssetServicesConnector.
+
This is where the connectors are specified for each service. As you can see, the asset service here is specified to use the LocalAssetServicesConnector.
  
 
Further down, you can see the section
 
Further down, you can see the section
Line 52: Line 54:
 
     LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"
 
     LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"
  
This is where we tell OpenSim which DLL to load for the in-process asset service.
+
This is where we tell OpenSimulator which DLL to load for the in-process asset service.
  
===Grid===
+
=== Grid ===
  
 
Compare this with Grid.ini.
 
Compare this with Grid.ini.
Line 64: Line 66:
 
     ...
 
     ...
  
In this case, the asset service connector is specified as the RemoteAssetServicesConnector class.
+
In this case, the asset service connector is specified as the RemoteAssetServicesConnector class.  
  
The [AssetService] section isn't in this file because we don't load a service class directly (seeing as the service is hosted remotely). Rather, we need to specify the URL where the asset service is found. Since this will be different for various grid installations, it's in the user configurable GridCommon.ini file instead.
+
The [AssetService] section isn't in this file because we don't load a service class directly (seeing as the service is hosted remotely). Rather, we need to specify the URL where the asset service is found. Since this will be different for various grid installations, it's in the user configurable GridCommon.ini file instead.
  
 
  [AssetService]
 
  [AssetService]
Line 74: Line 76:
 
     ;   
 
     ;   
 
     AssetServerURI = "http://myassetserver.com:8003"
 
     AssetServerURI = "http://myassetserver.com:8003"
 +
 +
== References ==
 +
 +
For some more extensive but somewhat outdated documentation on services and connectors, please see [[OpenSim Services and Service Connectors]]
 +
 +
See [[Services]] for a summary of services.

Latest revision as of 23:26, 13 January 2013


Contents

[edit] Overview

There are up to 5 components involved in connecting simulator code to a grid service. These are

Component Location Description
The simulator code itself OpenSimulator core or a module This initially references the service to get or set data.
The simulator service connector OpenSim/Region/CoreModules/ServiceConnectorsOut (for outbound connections) and ServiceConnectorsIn (for inbound connections) These connectors come in two flavours, local and remote. The local connectors connect directly to the service and are used when caller and service are in the same process (as in the standalone configuration). The remote connectors use the service connectors in OpenSim/Services/Connectors to make a call over the network to some remote process.
The remote service connector OpenSim/Services/Connectors These do the work of actually marshalling the data and make the appropriate call to a remote data service. These are not used for in-process connections.
The remote service handler OpenSim/Server/Handlers These are not used for in-process connections. These unpack the call received from a simulator connector and pass it on to the service itself.
The service Each major service has its own package (e.g. OpenSim/Services/AssetService). The service actually services the call and returns data to the caller, if applicable.

[edit] Example

Let's take a look at the asset service. The asset service connector is available as the Scene.AssetService property in the Scene object (direct references aren't always available - sometimes the connector has to be requested via the Scene.RequestModuleInterface<Interface>() mechanism).

A caller executes the method Scene.AssetService.Get() to retrieve an asset synchronously.

Suppose first of all that we're running a standalone configuration where both simulator and service are in the same process. In this case, the simulator's call goes to the LocalAssetServiceConnector.Get(). This first checks the cache, and if the asset isn't found there, then calls AssetService.Get(). The AssetService retrieves the asset from persistent storage and passes it back to the simulator code.

Now let's suppose that we're running in a grid configuration, where the asset service is operating on some other machine. As before, the simulator code calls Scene.AssetService.Get(). This time, the call is routed to RemoteAssetServiceConnector.Get(), which in this case inherits from OpenSim/Services/Connectors/AssetServiceConnector.

AssetServiceConnector.Get() generates an HTTP call to http://yourassetserver/assets/assetId, where assetId is the id of the asset requested.

This hops over the network and is handled by OpenSim/Server/Handlers/Asset/AssetServerConnector. It uses its own AssetServerGetHandler to unpack the HTTP request and call the AssetService to retrieve the data. If the asset is found, then it returns the asset as XML ready for the receiving AssetServiceConnector to unpack. If the asset is missing then it returns a 404 HTTP status code.

[edit] Configuration

Connectors are configured in OpenSimulator configuration files. For standalone, the configuration is in bin/config-include/Standalone.ini. Standalone users never need to change this file. For grid users, the configuration is in bin/config-include/Grid.ini and GridCommon.ini. In the grid case, GridCommon.ini (after copying from GridCommon.ini.example) is where the user specifies the URLs for each grid service.

[edit] Standalone

Let's look at Standalone.ini. You'll see that there is a Modules section with the lines

[Modules]
   AssetServices           = "LocalAssetServicesConnector"
   InventoryServices       = "LocalInventoryServicesConnector"
   NeighbourServices       = "LocalNeighbourServicesConnector"
   ...

This is where the connectors are specified for each service. As you can see, the asset service here is specified to use the LocalAssetServicesConnector.

Further down, you can see the section

[AssetService]
   LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"

This is where we tell OpenSimulator which DLL to load for the in-process asset service.

[edit] Grid

Compare this with Grid.ini.

[Modules]
   AssetServices     = "RemoteAssetServicesConnector"
   InventoryServices   = "RemoteXInventoryServicesConnector"
   GridServices      = "RemoteGridServicesConnector"
   ...

In this case, the asset service connector is specified as the RemoteAssetServicesConnector class.

The [AssetService] section isn't in this file because we don't load a service class directly (seeing as the service is hosted remotely). Rather, we need to specify the URL where the asset service is found. Since this will be different for various grid installations, it's in the user configurable GridCommon.ini file instead.

[AssetService]
   ...
   ;   
   ; change this to your grid-wide asset server
   ;   
   AssetServerURI = "http://myassetserver.com:8003"

[edit] References

For some more extensive but somewhat outdated documentation on services and connectors, please see OpenSim Services and Service Connectors

See Services for a summary of services.

Personal tools
General
About This Wiki