Welcome, guest | Sign In | My Account | Store | Cart

Install MQ Connection Factory at node level.

Tcl, 111 lines
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
###   
### installMQQCF.tcl
###   
### Installs Websphere MQ Queue Connection Factory at the Node level - name WebSphereQCF
###   
   
proc set_MQ_QCF {MQJMSProviderID nname qcfname mqhname mqchannel mqport mqqmgr} {   
   
   
###   
### set up globals   
###   
   
global AdminConfig   
global AdminControl   
global AdminApp   

###
### create Websphere MQ Queue Connection Factory
###

set XAEnabled          [ list XAEnabled true         ]
set channel            [ list channel $mqchannel     ]
set agedTimeout        [ list agedTimeout 0          ]      
set connectionTimeout  [ list connectionTimeout 180  ]
set maxConnections     [ list maxConnections 50      ]
set minConnections     [ list minConnections 1       ]
set purgePolicy        [ list purgePolicy FailingConnectionOnly ]
set reapTime	       [ list reapTime 180           ]
set unusedTimeout      [ list unusedTimeout 1800     ]
set connectionPool     [ list connectionPool [list $agedTimeout $connectionTimeout $maxConnections $minConnections $purgePolicy $reapTime $unusedTimeout ] ]
set description        [ list description "$qcfname" ]
set host               [ list host $mqhname          ]
set jndiName           [ list jndiName mq/$qcfname   ]
set authDataAlias      [ list authDataAlias none     ]
set mappingConfigAlias [ list mappingConfigAlias DefaultPrincipalMapping ]
set mapping            [ list mapping [list $authDataAlias $mappingConfigAlias ] ]
set msgRetention       [ list msgRetention true      ]
set name	       [ list name "$qcfname"        ]
set port	       [ list port $mqport	     ]
set queueManager       [ list queueManager $mqqmgr   ]
set agedTimeout1       [ list agedTimeout 0          ]      
set connectionTimeout1 [ list connectionTimeout 180  ]
set maxConnections1    [ list maxConnections 10      ]
set minConnections1    [ list minConnections 1       ]
set purgePolicy1       [ list purgePolicy FailingConnectionOnly ]
set reapTime1          [ list reapTime 180           ]
set unusedTimeout1     [ list unusedTimeout 1800     ]
set sessionPool        [ list sessionPool [ list $agedTimeout1 $connectionTimeout1 $maxConnections1 $minConnections1 $purgePolicy1 $reapTime1 $unusedTimeout1 ] ]
set CCSID	       [ list CCSID 819              ]
set transportType      [ list transportType CLIENT   ]

   set attrs [ list $XAEnabled        	\
                    $channel		\
                    $connectionPool    	\
                    $description      	\
                    $host               \
		    $jndiName           \
                    $mapping            \
		    $msgRetention       \
	       	    $name	        \
    		    $port		\
    		    $queueManager	\
    		    $sessionPool	\
    		    $CCSID		\
    		    $transportType				    
	     ]

   puts " ATTRS = $attrs"

   if { [ catch { $AdminConfig create MQQueueConnectionFactory $MQJMSProviderID $attrs } r ] == 0 } {

       $AdminConfig save
       
       } else {

       puts "\nproblem creating MQQueueConnectionFactory $MQJMSProviderID. \n"
       puts $r 
       puts "************************************\n"
       return -code error $r
   }

### Synchronize nodes

puts "Synchronizing nodes..."
set Sync1 [$AdminControl completeObjectName type=NodeSync,node=$nname,*]
set xstatus [$AdminControl invoke $Sync1 sync]

if {$xstatus == "false"} {
    puts "Unable to synchronize nodes..."
}
   
}   
      
###   
### Main   
###   
if { !($argc == 7) } {   
   puts ""   
   puts "Insufficient arguments supplied on command line:  "   
   puts " "   
} else {    
   set MQJMSProviderID    [lindex $argv 0]
   set nname              [lindex $argv 1]	
   set qcfname            [lindex $argv 2]
   set mqhname            [lindex $argv 3]
   set mqchannel	  [lindex $argv 4]
   set mqport             [lindex $argv 5]
   set mqqmgr             [lindex $argv 6]
   set_MQ_QCF $MQJMSProviderID $nname $qcfname $mqhname $mqchannel $mqport $mqqmgr 
}   
Created by Patrick Finnegan on Tue, 18 Oct 2005 (MIT)
Tcl recipes (162)
Patrick Finnegan's recipes (56)

Required Modules

  • (none specified)

Other Information and Tasks