@@ -12,20 +12,33 @@ package main
12
12
import (
13
13
"fmt"
14
14
"log"
15
+ "os"
16
+ "strconv"
15
17
16
18
"github.com/ibm-messaging/mq-golang-jms20/mqjms"
17
19
)
18
20
19
21
func main () {
20
22
fmt .Println ("Beginning world!!!" )
21
23
24
+ fmt .Println ("host: " , os .Getenv ("HOSTNAME" ))
25
+ fmt .Println ("port: " , os .Getenv ("PORT" ))
26
+ fmt .Println ("qm: " , os .Getenv ("QMNAME" ))
27
+ fmt .Println ("channel: " , os .Getenv ("CHANNELNAME" ))
28
+
29
+ fmt .Println ("user: " , os .Getenv ("USERNAME" ))
30
+ fmt .Println ("pw: " , os .Getenv ("PASSWORD" ))
31
+
32
+ portNum , _ := strconv .Atoi (os .Getenv ("PORT" ))
33
+
34
+ // Initialise the attributes of the CF in whatever way you like
22
35
cf := mqjms.ConnectionFactoryImpl {
23
- QMName : "QM1" ,
24
- Hostname : "myhostname.com" ,
25
- PortNumber : 1414 ,
26
- ChannelName : "SYSTEM.DEF.SVRCONN" ,
27
- UserName : "username" ,
28
- Password : "password" ,
36
+ QMName : os . Getenv ( "QMNAME" ) ,
37
+ Hostname : os . Getenv ( "HOSTNAME" ) ,
38
+ PortNumber : portNum ,
39
+ ChannelName : os . Getenv ( "CHANNELNAME" ) ,
40
+ UserName : os . Getenv ( "USERNAME" ) ,
41
+ Password : os . Getenv ( "PASSWORD" ) ,
29
42
}
30
43
31
44
// Creates a connection to the queue manager, using defer to close it automatically
0 commit comments