Sample script to create a gateway

set PATH "C:\\MQeScript\\gateway" 
set ADDRESS 127.0.0.1 
set GATEWAYQM gatewayqm 
set LISTENER listener 
set GATEWAYPORT 1881 
set PROXY QM_jane 
set BRIDGE bridge 
set REALBRIDGEQ mqlocalq 
set CC FOR.GATEWAYQM. 
set LISTEN togateway 
set BRIDGEQ bridgeq 
set SYNCQ SYNC.QUEUE. 
set PORT 1414 set QNUM 50

#create the gateway queue manager

if { [catch {mqe_script_qm -create -qmname $GATEWAYQM -qmpath $PATH} error] } {
 		puts "An error occurred creating queue manager";
 		puts "The reason was: $error"
 		exit
} else {
     puts "Queue manager created"
}  

#load the queue manager

if { [catch {mqe_script_qm -load} error] } {
    puts "An error occurred loading queue manager";
 		puts "The reason was: $error"
 		exit
} else {
     puts "Queue manager loaded"
}   

#create the listener

if { [catch {mqe_script_listen -create -listenname $LISTENER -port 
$GATEWAYPORT} error] } {
 		puts "An error occurred creating a listener";
 		puts "The reason was: $error"
 		exit 
} else {
      puts "Listener created" }   

#create a bridge

if { [catch {mqe_script_bridge -create -bridgename $BRIDGE} error] } 
{
            puts "An error occurred creating bridge";
            puts "The reason was: $error"
            exit
} else {
      puts "Bridge created" 
}

#create a mq proxy

if { [catch {mqe_script_mqproxy -create -proxyname $PROXY -bridgename $BRIDGE -hostname $ADDRESS} error] } {
            puts "An error occurred creating proxy";
            puts "The reason was: $error"
            exit
} else {
      puts "MQ queue manager proxy created"
}  

#create a connection to the WebSphere® MQ queue manager

if { [catch {mqe_script_condef -create -cdname $PROXY -type mq} error] } {
            puts "An error occurred creating connection for the MQ queue manager";
            puts "The reason was: $error"
            exit
} else {
      puts "Connection to MQ queue manager created" 
}

#create the client connections, listeners and bridge queues

for {set j 1} {$j <= $QNUM} {incr j} {
      #create all the client connections

if { [catch {mqe_script_mqconn -create -clientconnname $CC$j -proxyname $PROXY 
-bridgename $BRIDGE -syncqname $SYNCQ$j -port $PORT} error] } {
            puts "An error occurred creating client connection $CC$j";
            puts "The reason was: $error"
            exit
} else {
            puts "client connection created"
}

#create all the listeners on the new client connections

if { [catch {mqe_script_mqlisten -create -listenname $LISTEN -clientconnname $CC$j 
-proxyname $PROXY -bridgename $BRIDGE} error] } {
            puts "An error occurred creating listener $LISTEN on client connection $CC$j"; 		
            puts "The reason was: $error" 		
            exit
} else {
            puts "listener created"
}

#create all the bridge queues

if { [catch {mqe_script_bridgeq -create -qname $BRIDGEQ$j -bridgename $BRIDGE 
-destination $PROXY -mqqname $REALBRIDGEQ -clientconnname $CC$j} error] } {
            puts "An error occurred creating bridge queue $BRIDGEQ ";
            puts "The reason was: $error"
            exit
            } else {
                   puts "bridge queue created"
            }
}

# We've finished the script... let's close the queue manager

if { [catch {mqe_script_qm -unload} error] } {
            puts "Failed to stop the queue manager"
            puts "The reason was: $error"
            exit }
else {
            puts "Queue manager stopped"
}
puts "CreateGatewayQM script completed successfully"
exit 0 

Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.