Package wt.router

router package — Routing Service

The routing service is designed to aid in scalability for different agent services by providing a convenient way to distribute execution of tasks to multiple Windchill method servers.

See:
          Description

Exception Summary
RouterException

Supported API: true

Extendable: false
 

Package wt.router Description

router package — Routing Service

The routing service is designed to aid in scalability for different agent services by providing a convenient way to distribute execution of tasks to multiple Windchill method servers. The persistent routing service uses standard Windchill queue service and uses the scheduler service on demand.

 

Design Overview

 

 

 

 

Router Model

 

The routing service is a keyed event listener whichlistener, which listens for RoutingEvent objects. The association between a routerEvent router event and the corresponding router object determines how who handles the event.the event is handled. These elements are registered in the wt.properties file.

A router object can operate in two modes: immediate and scheduled. Immediate mode router objects, upon catching an event they are registered to handle, immediately create and send an execution item to the queue. Scheduled mode router objects, upon catching an event they are registered to handle, store the data in a to-do list. The StandardSchedulingService invokes the static method processToDoList defined in the scheduled mode router object. This method scans

the to-do list, creates execution items, and sends them to queues. The StandardRoutingService uses RoundRobinRouter for routing execution items.

Resource intensive operations should use scheduled mode; non-resource intensive applications should use immediate mode. The ultimate choice depends on the design intent of your system as a whole.

A RoutedEvent object is a subclass of KeyedEvent. Extend this class to classify the events and to define router actions for each of them. The wt.properties file entries specify the method name but not its signature. All invoked methods must be of the following form:

         static void a_method( Serializable targObject, Serializable[ ] args);

The following table describes various property names.

 

Property Name

Description

Wwt.router.X, where X= 1,2…*

 

Router name. The router names must be sequential and in ascending order.

ROUTER_NAME.immediate = false

 

Mode of the specified router (where ROUTER_NAME conforms to the router name syntax). Default is false; that is, scheduled mode.

ROUTER_NAME.NumOfQueues = 1

Number of queues used by the specified router. Default is 1.

ROUTER_NAME.method

 

Default fully-specified method name for all the events caught by the specified router (for example, wt.router.1.myroot.mypack.myClass.myMethod).

ROUTER_NAME.event.Y, where Y = 1,***

Fully-specified event class caught by the specified router.

ROUTER_NAME.event.Y.method,

where Y = 1.*

Default fully-specified method name for event Y caught by the specified router.

ROUTER_NAME>event.Y.class.Z,

where Y and Z are 1…*

Fully-specified target-object class caught with event Y by the specified router.

ROUTER_NAME.event.Y.class.Z.

method

Fully-specified method name for event Y and target-object class Z caught by the specified router.

 

 

The names of all the queues started by the persistent router service are defined as follows:

wt.router.X.Y:

wt.router.X  -   The name of the router.

Y -  A- A sequence number that ranges from 1 to the value of the NumOfQueues property associated with the router name.

 

Example

This example shows how you can use this service by following these four steps:

1. Define an event:

Class SampleEvent extends wt.router.RoutingEvent

{

public SampleEvent(String evtType, Serializable eventTarget)

{

super(evtType, eventTarget);

}

}

2. Define a method to invoke:

Class SampleClass

{

. . .

static void aSampleMethod(Serializable targetObject){

//some code to save the world}

}

3. Emit the event:

. . .

SampleEvent se = new SampleEvent("MY_SAMPLE_EVENT",

a_serializableObject);

getManagerService().dispatchVetoableEvent(se,se.getEventKey());

4. Configure the router by placing the following five lines in the wt.properties file:

Wwt.router.1 = myRouter

myrouter.immediate=false

myRouter.NumberOfQueues=1

myRouter.method=SampleClass.aSampleMethod

myRouter.event.1=SampleEvent