Skip to content

Remote Method Invocation

Jasper Nalbach edited this page Feb 11, 2016 · 4 revisions

Services in las2peer should reuse code and communicate with each other. This is done by method invocations.

If possible, the method will be executed on the local node. Otherwise, another node in the network will be employed to handle the call.

If you want to call the method with the current context's main agent as calling agent, use

Object invokeServiceMethod("[email protected]", "myMethod", (int) param1, (String) param2, ...)

The current service agent can also be used as executing entity to handle service-related requests:

Object invokeInternally(String serviceIdentifier, String method, Serializable... parameters)

Do not use invokeInternally for user-related actions as this will bypass las2peer's permission system.

Specifying versions

The first parameter serviceIdentifier of the methods shown above allows to specify a service version to be invoked. Specifying a service version is recommended since a service A might change the API in a newer version and all services invoking service A may break.

Service versions have the format major.minor.sub-build where minor, sub and build are optional. When specifying a version, an appropriate version will be picked as follows: If version 1.0 is specified, all versions starting with 1.0 fit (e.g. 1.0.5-123, but not 1.1). las2peer tries to invoke the newest version that fits to the specified version, but this is not guaranteed (due to the fact that the local node is preferred to global invocations).

If no version has been specified (e.g. i5.las2peer.services.exampleService.ServiceClass), the newest version is used (where the local node is preferred).

Clone this wiki locally