Redwood Documentation

Product Documentation

 

›RedwoodScript

RunMyJobsRedwoodScript Development

Developing Applications

  • Developing Applications

RedwoodScript

  • RedwoodScript
  • Scripting in the Shell
  • Mixing REL and RS Code in a Library
  • Controlling Process Servers with RedwoodScript
  • Controlling Queues with RedwoodScript
  • Managing Applications with RedwoodScript
  • Substitution Parameters
  • Date Formatting and Parsing
  • Impact of Modified Process Definitions or Chain Definitions on Processes and Chains
  • Using the RedwoodScript Definition Type
  • Using RedwoodScript in Processes
  • Using Eclipse to Create and Edit Process Definitions

Debugging Your Code

  • Changing Process Logging Levels

Triggering Custom Code

  • Triggering Custom Code
  • Using Triggers
  • Trigger and Action Examples
  • Using Actions
  • Executing Your Own Classes from a Library
  • Library Examples
  • Extending Redwood Server Functionality with Extension Points
  • Extending Edit Pages with ObjectPageExtensionPoint
  • Creating Extension Points
  • Extending Redwood Server Functionality with Extension Points

Using Tables

  • Using Tables to Store Frequently Used Values

PL/SQL API

  • Cronacle PL/SQL API Module
  • Creating the OracleJob Process Server
  • Using the OracleJob Definition Type
  • Packages
  • RS/JCS Views

Tuning Redwood Platform

  • Tuning Redwood Platform

Memory Tuning

  • Tuning Memory Usage and Garbage Collection

Reference

  • Using SQL to Query the Data Model
  • Embed Redwood Server Overviews into Extension Points with the Embed API
  • API Documentation
  • Script Date Formats
  • Datamodel
  • Redwood Expression Language Functions and Implicit Objects
  • RedwoodScript Scripting Contexts and Implicit Objects
← Controlling Process Servers with RedwoodScriptManaging Applications with RedwoodScript →

Controlling Queues with RedwoodScript

When you have a lot of repetitive tasks to perform, it is often easier to use script. RedwoodScript allows you to control queues, and you can hold all queues, regardless of the total number, with a few lines of code. The following examples illustrate how you can use RedwoodScript to control queues. Redwood Software does not warrant that this is the most effective way to solve your problem. For more information on RedwoodScript, see the API documentation.

Example

Holding a queue

{
  // get the queue GLOBAL.TR2_Queue
  queue = jcsSession.getQueueByName("TR2_Queue");
  // check to see if the queue is open
  if (queue.isOpen())
  {
    //hold the queue
    queue.hold();
    jcsSession.persist();
  }
}


Changing the State of a Queue

This is an example of how you can retrieve the status of a queue.

{
  //get the queue RW_DEMO.TR2_Queue
  Partition part = jcsSession.getPartitionByName("RW_DEMO");
  Queue queue = jcsSession.getQueueByName(part, "TR2_Queue");

  //check if the queue is open
  if (queue.isOpen())
  {
    //queue is open
    queue.hold();
    jcsSession.persist();
  }
  else
  {
    //queue is held
    queue.release();
    jcsSession.persist();
  }
}


Holding all Queues

You can hold all queues, except system queue. Retrieve the queues using executeObjectQuery.

{
  String query = "select Queue.* from Queue where Name <> 'System'";
  for (Queue queue : jcsSession.executeObjectQuery(Queue.TYPE, query))
  {
    if(queue.isOpen())
    {
      jcsOut.println("Holding queue " + queue.getName() + ", which has the status " + queue.getStatus() + ".");
      queue.hold();
      jcsSession.persist();
    }
  }
}


Adding a Process Server to a Queue

{
  Queue queue = jcsSession.getQueueByName("TR1_Queue");

  ProcessServer proc = jcsSession.getProcessServerByName("TR2_ProcessServer");

  queue.createQueueProvider(proc);

  jcsSession.persist();
}


List all Process Servers Serving a Queue

A queue provider is the link between a process server and a queue, to find all the process servers serving a queue, we need to list the queue providers.

{
  Partition p = jcsSession.getPartitionByName("MyPart");
  Queue queue = jcsSession.getQueueByName(p, "My_Queue");
  for (QueueProvider provider : queue.getQueueProviders())
  {
    jcsOut.println(provider.getProcessServer().getName());
  }
}


See Also

  • RedwoodScript
  • Creating a Queue
  • Using Queues to Administer Process Execution
  • Using Resources to distribute the load
  • Privileges Required to use Queues

Redwood Script

← Controlling Process Servers with RedwoodScriptManaging Applications with RedwoodScript →
  • Example
  • Holding a queue
  • Changing the State of a Queue
  • Holding all Queues
  • Adding a Process Server to a Queue
  • List all Process Servers Serving a Queue
  • See Also
Docs
Getting StartedInstallationFinance InstallationConcepts
TroubleshootingArchiving
Learn and Connect
Support Portal
BlogEventsResources
ISO/ IEC 27001 Information Security Management
Automate to be human

2023 All Rights Reserved |

Terms of Service | Policies | Cookies | Glossary | Third-party Software | Contact | Copyright | Impressum |