Task Script Examples

In this section:

This section provides examples that can only be executed as a Task because they require parameters to be set. Executing them in the file browser will result in an error appearing in the activity feed.

Note: All variables underlined must be defined when creating a Task.


Top of page

x
Change Channel Worker Threads

The following example sets the number of worker threads for a channel to 2.

$(".channel").property(serverName, applicationName, channelName, "config.count", "2");

Top of page

x
Change Server JVM Options

The following example sets the JVM options for a server.

$(".server").property(serverName, "config.JVM_OPTION", "-Xmx=512");

Top of page

x
Deploy a Package

The following example deploys a package to a server. You must create a package from SPOG prior to deploying in a script. You cannot create a package in a script.

$(".package").deploy(serverName, packageArtifactName);

Top of page

x
Undeploy a Package

The following example undeploys a package.

$(".package").undeploy(serverName, packageArtifactName);

Top of page

x
Deploy an Application

The following example deploys an application. An example of portNumber could be 10003.

$(".application").deploy(serverName,
                         applicationName, 
                         iiaArtifactName, 
                         portNumber,	// integer
                         templateArtifactName, 
                         description, 
                         overwrite 	// boolean
                         );

Top of page

x
Undeploy an Application

The following example undeploys an application.

$(".application").undeploy(serverName, applicationName)

Top of page

x
Start an Application

The following example starts an application.

$(".application").start(serverName, applicationName);

Top of page

x
Stop an Application

The following example stops an application.

$(".application").stop(serverName, applicationName);

Top of page

x
Start a Channel

The following example retrieves all the channels from an application and starts the channel matching the channelName.

var channels = $(".application").channels(serverName, applicationName);
for(i in channels) {
        if(channels[i].name == channelName) {
              $(".channel").start(channels[i].id);
              break;
        }
}

Top of page

x
Stop a Channel

The following example retrieves all the channels from an application and stops the channel matching the channelName.

var channels = $(".application").channels(serverName, applicationName);
for(i in channels) {
        if(channels[i].name == channelName) {
              $(".channel").stop(channels[i].id);
              break;
        }
}

iWay Software