Introduction

 
 

Online Documentation    CLI User's Guide    Introduction

 
 

[General]     [Starting CLI]     [Running CLI Scripts]     [Management Tree]    
[Document Index]

 
     
 
  General

CLI is a command line interface for remote configuration and administration of SwiftMQ routers. CLI's access takes place via JMS, so every JMS listener with his specific socketfactory (i.e. SSL) can be used for configuration.

By accessing one router of a connected router network via CLI, all routers of this network can be configured if the specific user has a send grant for queue swiftmqmgmt on each of this routers. The grant must be defined on the router where CLI is connected to.

Starting CLI

CLI can be started by the platform specific scripts provided in the scripts directory of the SwiftMQ distribution or by the following command:


 java com.swiftmq.admin.cli.CLI <jndi-url> <qcf>

Where <jndi-url> is the JNDI-Provider-URL for JNDI-Lookups and <qcf> is the name of the queue connection factory to lookup.

The JNDI provider URL specifies the properties of the underlying JMS connection with the following format:


 smqp://[<user>[:<password>]@]<host>:<port>[/[type=<type>][;timeout=<long>][;compress=<boolean>]

Where


 smqp ::= Specifies the SwiftMQ Protocol
 <user> ::= Username. Default is 'anonymous'
 <password> ::= User's password. Default is null.
 <host> ::= DNS hostname of the router
 <port> ::= JMS inbound listener port
 type ::= Class name of the socket factory used by this JMS inbound listener.
  In this release, com.swifmq.net.PlainSocketFactory and
  com.swiftmq.net.JSSESocketFactory are available. Default is
  com.swifmq.net.PlainSocketFactory. See JMSSwiftlet configuration for details.
 timeout ::= Specifies a timeout in milliseconds for lookups. If no JNDI object is
  received within this time, the lookup returns null. Default is no timeout;
  lookups are waiting until they receive the requested JNDI objects.
 compress ::= Specifies if the specific JMS connection has line compression. Default is
  no compression.

After starting, CLI prompts for username/password and, if login is succeeded, lists all available routers, and displays a prompt, waiting for commands:


 $pamela> java com.swiftmq.admin.cli.CLI smqp://localhost:4001 QueueConnectionFactory
  
 Welcome to SwiftMQ!
  
 Username: admin
 Password: secret
 Trying to connect ... connected
 Type 'help' to get a list of available commands.
 Router 'pamela.iit.de' is available for administration.
 Router 'dev194.iit.de' is available for administration.
 >_

Running CLI Scripts

CLI is able to process CLI commands from a file. These files are called 'CLI Scripts'. To run a CLI script, put the filename as the 3rd parameter of the CLI command line. CLI processes these commands just like they were typed via the keyboard. Comments inside the scriptfiles could be marked with a '#' in the first column of the line.

Normally, CLI prompts for username/password after starting. To avoid this, define username/password as system properties on the commandline:

Example:


 java -Dcli.username=admin -Dcli.password=secret com.swiftmq.admin.cli.CLI smqp://localhost:4001 plainsocket@router1 jmsusage.cli

The distribution contains 2 example CLI scripts, jmsusage.cli and shutdown.cli. The first one displays the current JMS connections and running JMS threads, the second one performs a shutdown on the distributions router1.

Here is the content of jmsusage.cli:


 # CLI-Script to show the actual JMS connections
 # and the actual Threads in the JMS pool
 #
 sr router1
 lc sys$jms/usage
 lc sys$threadpool/usage/jms/run
 exit

The transcript of using it (we've used the 'clis' shell script in the distributions scripts directory):


 $pamela>./clis admin secret jmsusage.cli
 Router 'router1' is available for administration.
  
 Entity List: Usage
 Description: List of all active JMS Connections
  
 Entities in this List:
 ----------------------
 pamela.iit.de:1037
 pamela.iit.de:1039
  
  
 Entity List: Running Threads
 Description: List of all running Threads
  
 Entities in this List:
 ----------------------
 sys$jms/Connection pamela.iit.de:1037
 sys$jms/Connection pamela.iit.de:1037/Reader
 sys$jms/Connection pamela.iit.de:1037/Session 1
 sys$jms/Connection pamela.iit.de:1037/Session 1/ConsumerManager/Consumer 0 on tmp$2@router1
 sys$jms/Connection pamela.iit.de:1037/Session 2
 sys$jms/Connection pamela.iit.de:1037/Writer
 sys$jms/Connection pamela.iit.de:1039
 sys$jms/Connection pamela.iit.de:1039/Reader
 sys$jms/Connection pamela.iit.de:1039/Session 1
 sys$jms/Connection pamela.iit.de:1039/Session 1/ConsumerManager/Consumer 0 on tmp$5@router1
 sys$jms/Connection pamela.iit.de:1039/Session 2
 sys$jms/Connection pamela.iit.de:1039/Writer
 sys$jms/ConnectionManager
 sys$jms/Listener plainsocket, port=4001
  
 $pamela>_

And here that of shutdown.cli:


 # CLI-Script to shutdown router1
 #
 sr router1
 halt
 exit

And the transcript:


 $pamela>./clis admin secret shutdown.cli
 Router 'router1' is available for administration.
  
 Router Halt in 5 Seconds.
  
 $pamela>_

Management Tree

CLI is organized as a tree of management contexts. At the top level there are the available routers. Each router has a number of Swiftlets, and each Swiftlet can have entity lists and properties, each entity list can have a number of entities, and each entity can have a number of properties.



The structure of the tree reflects the structure of SwiftMQ's Property Configuration File.

CLI provides commands to switch between router contexts, to navigate within a context, to add/remove entities, to change properties, to save router configurations, and to reboot or halt routers.

 
 
     
 

[General]     [Starting CLI]     [Running CLI Scripts]     [Management Tree]    
[Document Index]

 
 

Online Documentation    CLI User's Guide    Introduction

 
 

 Copyright © 2000, IIT GmbH, Bremen/Germany. All rights reserved.
SwiftMQ and Swiftlet are registered trademarks of IIT GmbH.
All other product names mentioned herein are trademarks of their respective owners.