Communication Methods

These methods are used for communicating between extensions.

CallExtension

Since version 9.8

Used to let extensions communicate with each other, this event overrides the specified method of the CallExtensionForSINI() SXI event described on page 123 and returns the result back to the calling extension.

Method

int CallExtension(string uniqueName, string method, string arguments, out string result);

Example

An extension named WebExtension implements the SXI event as

public override int CallExtensionForSINI(string method, string arguments, out string result)

{

switch (method)

{

case "reverse":

string[] list = arguments.Split(',');

result = string.Join(",", list.Reverse());

return eSuccess;

... other cases ...

}

result = null;

return eSuccess;

}

Then an extension can call the CallExtension() method:

string the_answer;

int n = Storefront.CallExtension("yourNamespace.WebExtension", "reverse", "1,2,3", out the_answer);

which returns “3,2,1” for the result.

Remarks

The calling extension should check for errors. Also, implementations should be very careful about using this method as it would be easy to create an infinite loop of calls that would be very hard to debug.

ResetExtension

Since version 9.8

Sends a message to all copies of the extension running on other web hosts in the cluster, triggering the ResetCachedData() SXI event described on page 154.

Method

int ResetExtension(string extensionUniqueName);

Parameter

extensionUniqueName — The extension’s UniqueName property.

Returns

Returns eSuccess(0) if the message was sent successfully.

Remarks

If extensionUniqueName is null then it triggers the event in all extensions everywhere.