Nirvana Scheduling : Tasks

Tasks are executed by either time based (calendar) or conditional triggers. There are a number of tasks that can be executed by the Nirvana Scheduling engine. Each task corresponds to a unit of work that performs an operation on the desired object within a Nirvana realm.

This section will discuss the available tasks that can be declared within a Nirvana scheduling script :

To view examples of scheduling scripts, please click here.

Task Expressions

Task expressions are comprised of the object on which you wish to perform the operation, and the required parameters. For more information on the grammar for task expressions, please see the writing scripts help file. The following sections will describe the task objects and the parameters required to perform them. The example below demonstrates both Interface, Logger and Counter tasks.

scheduler realmInterfaceSchedule {

declare Interface myNHP ("nhp0");
declare Counter myCounter("myExhaustedThreads");

when (myNHP.idleThreads == 0) {

Logger.report("NHP0 Interface has no idles Threads");
myCounter.inc();

}

when (myCounter >= 5) {

Logger.report("Increasing the accept thread count on NHP0");
myNHP.threads("+10");
myCounter.reset();

}

}

Store Tasks - Channel / Queue operations

Store tasks can be used by first of all declaring the desired object as in the following syntax:

declare Store myChannel("/customer/sales");

The table below lists those tasks available on a Store object, such that the task expression will look like :

when (myChannel.numOfEvents < 100) {

myChannel.maintain();

}

Task Object Syntax Description
maintain

Store.maintain("*");
Store.maintain("/customer/sales");
myChannel.maintain();

Perform maintenance on a channel so that any purged events are removed from the channel or queue event store.
publish myChannel.publish("Byte array data", "tag", "key1=value1:key2:value2" ); Publish an event to the channel / queue, using the given byte array, event tag and event dictionary values.
purge

myChannel.purge();
myChannel.purge(0, 100000);
myChannel.purge(0, 10000, "key1 = 'value1'");

Purge all events on a channel, or events between a start and end eid, or using a purge filter.
createChannel myChannel.createChannel(0, 0, "P");
Create the channel using the name it was declared as, and the ttl, capacity and type specified in the parameters
createQueue myChannel.createQueue(0, 0, "P"); Create the queue using the name it was declared as, and the ttl, capacity and type specified in the parameters

Interface Tasks - Nirvana Interface operations

Interface tasks are operations that can be performed on all interfaces or individually declared interfaces. To declare an interface use the following syntax as an example:

declare Interface myNHP("nhp0");

The table below lists those tasks that can be executed on an Interface object, such that the task expression will look like :

when (myNHP.connections > 1000) {

myNHP.threads("+10");

}

Task Object Syntax Description
stop myNHP.stop();
Interface.stop("nhp0");
Stop the interface
start myNHP.start();
Interface.start("nhp0");
Start The interface
stopAll Interface.stopAll(); Stop all interfaces on the realm
startAll Interface.startAll(); Start all interfaces on the realm
authTime myNHP.authTime(20000);
myNHP.authTime("+10000");
Set the interface authentication time to a value, or increase / decrease it by a value.
backlog myNHP.backlog(200);
myNHP.backlog("+100");
Set the interface backlog time to a value, or increase / decrease it by a value.
autoStart myNHP.autoStart("true");
myNHP.autoStart("false");
Set whether an interface is automatically started when the realm is started.
advertise myNHP.advertise("true");
myNHP.advertise("false");
Set whether an interface is available to clients using the admin API.
certificateValidation myNHP.certificateValidation("true");
myNHP.certificateValidation("false");
Set whether an interface (SSL) requires clients to provide a certificate to authenticate.
threads myNHP.threads(10);
myNHP.threads("+10");
Set the interface accept threads to a value or increase / decrease it by a value.

MemoryManager Triggers - Nirvana JVM Memory Management operations

MemoryManager triggers are declared using the following syntax as an example:

declare MemoryManager mem;

The table below lists those triggers that can be evaluated on the memory management object, such that the task expression will look like :

when (mem.freeMemory < 1000000) {

}

Task Object Syntax Description
flush mem.flush(true);
mem.flush(false);
Cause the JVM to call garbage collection, and optionally release used memory

Counter Tasks - Counter tasks

Counter tasks allow you to increment, decrement, set and reset a local counter within the Nirvana scheduling engine. Counter tasks are declared using the following syntax as an example:

declare Counter counter1 ("myCounter");

The counter task can be executing by referencing the Counter object itself, and calling one of a number of available tasks. The basic counter task expression will look like :

when ( counter1 > 5) {

counter1.reset();

}

The table below shows the tasks that can be executed on the Counter task.

Task Object Syntax Description
dec counter1.dec() Decrement the counter by 1
inc counter1.inc() Increment the counter by 1
set counter1.set(5) Set the counter to a value
reset counter1.reset() Reset the counter to 0

Timer Tasks - Timer operations

Timer tasks allow you to start, stop and reset the timer. Time tasks are declared using the following syntax as an example:

declare Timer reportTimer ("myTimer");

The timer task can be executed by referencing the timer object itself, such that the task expression will look like :

when ( reportTimer == 60 ) {

reportTimer.reset();

}

The table below shows the tasks that can be executed on the Counter task.

Task Object Syntax Description
start reportTimer.start() Start the timer
inc reportTimer.stop() Stop the timer
reset reportTimer.reset() Reset the timer

Config Tasks - Channel / Queue based triggers

Config tasks can be used to set any configuration value available in the Config panel for a realm. Any configuration value can be used as part of a trigger task expression. Config tasks are declared using the following syntax as an example (below example refers to the 'GlobalValues' configuration group:

declare Config myGlobal ("GlobalValues");
declare Config myAudit ("AuditSettings");
declare Config myClientTimeout ("ClientTimeoutValues");
declare Config myCluster ("ClusterConfig");
declare Config myEventStorage ("EventStorage");
declare Config myFanout ("FanoutValues");
declare Config myJVM ("JVMManagement");
declare Config myJoinConfig ("JoinConfig");
declare Config myRecovery ("RecoveryDaemon");
declare Config myTXMgr ("TransactionManager");

The table below lists those tasks that can be evaluated on a config object, such that the task expression will look like :

when (myGlobal.MaxNoOfConnections == -1) {

myGlobal.MaxNoOfConnections(1000);

}

Trigger Object Syntax Description
GlobalValues    
SchedulerPoolSize myGlobal.SchedulerPoolSize(2); The number of threads assigned to the scheduler
MaxNoOfConnections myGlobal.MaxNoOfConnections(-1); Sets the maximum concurrent connections to the server, -1 indicates no restriction
StatusUpdateTime myGlobal.StatusUpdateTime(60000); The number of ms between status events being written to disk
StatusBroadcast myGlobal.StatusBroadcast(2000); The number of ms between status events being published
fLoggerLevel myGlobal.fLoggerLevel(4); The server logging level
NHPTimeout myGlobal.NHPTimeout(2000); The number of milliseconds the server will wait for client authentication
NHPScanTime myGlobal.NHPScanTime(10000); The number of milliseconds that the server will wait before scanning for client timeouts
HandshakeTimeout myGlobal.HandshakeTimeout(12000); The number of milliseconds that the server will wait for the session to be established
StampDictionary myGlobal.StampDictionary(true); Place Nirvana details into the dictionary (true/false)
ExtendedMessageSelector myGlobal.ExtendedMessageSelector(true); If true, allows the server to use the extended message selector syntax (true/false)
ServerTime myGlobal.ServerTime(true); Allow the server to send the current time to the clients (true/false)
SecureHandshake myGlobal.SecureHandshake(true); Performs a security handshake when connecting into a cluster
ConnectionDelay myGlobal.ConnectionDelay(2000); When the server has exceeded the connection count, how long to hold on to the connection before disconnecting
SupportVersion2Clients myGlobal.SupportVersion2Clients(true); Allow the server to support older clients (true/false)
SendRealmSummaryStats myGlobal.SendRealmSummaryStats(true); If true sends the realms status summary updates (true/false)
     
AuditSettings    
RealmMaintenance myAudit.RealmMaintenance(false); Log to the audit file any realm maintenance activity
InterfaceManagement myAudit.InterfaceManagement(false); Log to the audit file any interface management activity
ChannelMaintenance myAudit.ChannelMaintenance(false); Log to the audit file any channel maintenance activity
QueueMaintenance myAudit.QueueMaintenance(false); Log to the audit file any queue maintenance activity
ServiceMaintenance myAudit.ServiceMaintenance(false); Log to the audit file any service maintenance activity
JoinMaintenance myAudit.JoinMaintenance(false); Log to the audit file any join maintenance activity
RealmSuccess myAudit.RealmSuccess(false); Log to the audit file any successful realm interactions
ChannelSuccess myAudit.ChannelSuccess(false); Log to the audit file any successful channel interactions
QueueSuccess myAudit.QueueSuccess(false); Log to the audit file any successful queue interactions
ServiceSuccess myAudit.ServiceSuccess(false); Log to the audit file any successful realm interactions
JoinSuccess myAudit.JoinSuccess(false); Log to the audit file any successful join interactions
RealmFailure myAudit.RealmFailure(false); Log to the audit file any unsuccessful realm interactions
ChannelFailure myAudit.ChannelFailure(false); Log to the audit file any unsuccessful channel interactions
QueueFailure myAudit.QueueFailure(false); Log to the audit file any unsuccessful queue interactions
ServiceFailure myAudit.ServiceFailure(false); Log to the audit file any unsuccessful service interactions
JoinFailure myAudit.JoinFailure(false); Log to the audit file any unsuccessful join interactions
RealmACL myAudit.RealmACL(false); Log to the audit file any unsuccessful realm acl interactions
ChannelACL myAudit.ChannelACL(false); Log to the audit file any unsuccessful channel acl interactions
QueueACL myAudit.QueueACL(false); Log to the audit file any unsuccessful queue acl interactions
ServiceACL myAudit.ServiceACL(false); Log to the audit file any unsuccessful service acl interactions
     
ClientTimeoutValues    
EventTimeout myClientTimeout.EventTimeout(10000); The amount of ms the client will wait for a response from the server
DisconnectWait myClientTimeout.DisconnectWait(30000); The maximum amount of time to wait when performing an operation when disconnected before throwing session not connected exception
TransactionLifeTime myClientTimeout.TransactionLifeTime(10000); The default amount of time a transaction is valid before being removed from the tx store
KaWait myClientTimeout.KaWait(10000); The amount of time the client will wait for keep alive interactions between server before acknowledging disconnected state
LowWaterMark myClientTimeout.LowWaterMark(200); The low water mark for the connection internal queue. When this value is reached the outbound internal queue will again be ready to push event to the server
HighWaterMark myClientTimeout.HighWaterMark(500); The high water mark for the connection internal queue. When this value is reached the internal queue is temporarily suspended and unable to send events to the server. This provides flow control between publisher and server.
QueueBlockLimit myClientTimeout.QueueBlockLimit(5000); The maximum number of milliseconds a queue will have reached HWM before notifying listeners
QueueAccessWaitLimit myClientTimeout.QueueAccessWaitLimit(10000); The maximum number of milliseconds it should take to gain access to a queue to push events before notifying listeners
QueuePushWaitLimit myClientTimeout.QueuePushWaitLimit(12000); The maximum number of milliseconds it should take to gain access to a queue and to push events before notifying listeners
     
ClusterConfig    
HeartBeatInterval myCluster.HeartBeatInterval(60000); Heart Beat interval in milliseconds
SeparateLog myCluster.SeparateLog(true); Create a separate log file for cluster events
EventsOutStanding myCluster.EventsOutStanding(10); Number of events outstanding
     
EventStorage    
CacheAge myEventStorage.CacheAge(360000); The time in ms that cached events will be kept in memory for
ThreadPoolSize myEventStorage.ThreadPoolSize(2); The number of threads allocated to perform the management task on the channels
ActiveDelay myEventStorage.ActiveDelay(1000); The time in milliseconds that an active channel will delay between scans
IdleDelay myEventStorage.IdleDelay(60000); The time in milliseconds that an idle channel will delay between scans
     
FanoutValues    
ConcurrentUser myFanout.ConcurrentUser(5); The number of client threads allowed to execute concurrently in the server
KeepAlive myFanout.KeepAlive(60000); The number of milliseconds between the server will wait before sending a heartbeat
QueueHighWaterMark myFanout.QueueHighWaterMark(500); The number of events in a client output queue before the server stops sending events
QueueLowWaterMark myFanout.QueueLowWaterMark(200); The number of events in the clients queue before the server resumes sending events
MaxBufferSize myFanout.MaxBufferSize(1024000); The maximum buffer size that the server will accept
OutputBlockSize myFanout.OutputBlockSize(200); The size of the output block size
PublishDelay myFanout.PublishDelay(100); How long to delay the publisher when subscribers queue start to fill, in milliseconds
RoundRobinDelivery myFanout.RoundRobinDelivery(true); Use a round robin approach to event delivery (true/false)
PublishExpiredEvents myFanout.PublishExpiredEvents(true); Publish expired events at server startup (true/false)
     
JoinConfig    
MaxEventsPerSchedule myJoinConfig.MaxEventsPerSchedule(200); Number of events that will be sent to the remote server in one run
MaxQueueSizeToUse myJoinConfig.MaxQueueSizeToUse(50); The maximum events that will be queued on behalf of the remote server
ActiveThreadPoolSize myJoinConfig.ActiveThreadPoolSize(4); The number of threads to be assigned for the join recovery
IdleThreadPoolSize myJoinConfig.IdleThreadPoolSize(2); The number of threads to manage the idle and reconnection to remote servers
     
RecoveryDaemon    
ThreadPool myRecovery.ThreadPool(5); Number of threads to use for client recovery
EventsPerBlock myRecovery.EventsPerBlock(300); The number of events to send in one block
     
TransactionManager    
MaxTransactionTime myTXMgr.MaxTransactionTime(1000); Time in milliseconds that a transaction will be kept active
MaxEventsPerTransaction myTXMgr.MaxEventsPerTransaction(1000); The maximum number of events per transaction, a 0 indicates no limit
TTLThreshold myTXMgr.TTLThreshold(1000); The minimum time in milliseconds, below which the server will not store the Transaction ID