You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that for illustration purposes this sample only has limited error handling, which you should never do in production application code! Please see the TestSampleSendReceiveWithErrorHandling function for an equivalent sample that demonstrates good practice for error handling.
38
-
```
38
+
```golang
39
39
// Create a ConnectionFactory using details stored in some external property files
@@ -122,7 +122,7 @@ your own error handling or logging.
122
122
* Handle error codes returned by the queue manager - [sample_errorhandling_test.go](sample_errorhandling_test.go)
123
123
124
124
As normal with Go, you can run any individual testcase by executing a command such as;
125
-
```
125
+
```bash
126
126
go test -run TestSampleSendReceiveWithErrorHandling
127
127
```
128
128
@@ -142,7 +142,7 @@ The IBM MQ client on which this library depends is supported on Linux and Window
142
142
- Simply unzip the archive and make a note of the installation location. For ease of configuration you may wish to unzip the archive into the default install IBM MQ location for your platform
143
143
- Note that v9.1.1 (CD) or higher of the MQ client library is required as it includes header files that are not present in v9.1.0 LTS or below.
144
144
4. Git clone this project to download this JMS style implementation onto your workstation
145
-
```
145
+
```bash
146
146
# Update and set the GOPATH variable to match your workspace
147
147
export GOPATH=/home/myuser/workspace
148
148
@@ -159,7 +159,7 @@ The IBM MQ client on which this library depends is supported on Linux and Window
159
159
### Configuring your environment
160
160
161
161
First you must configure your command console environment as described in the [mq-golang Getting Started instructions](https://github.com/ibm-messaging/mq-golang#getting-started) so that the necessary flags are set;
162
-
```
162
+
```bash
163
163
# Configure your Go environment variables (update to match your own setup)
**If your client install is not located in the default installation location**, for example `/opt/mqm` then you also need to set the follow environment variables to point at your installation location. For example on Linux or MacOS;
@@ -203,7 +203,7 @@ The test cases use the `CreateConnectionFactoryFromDefaultJSONFiles` method to o
203
203
Once you have added the details of your queue manager and user credentials into the two JSON files and placed them in your `/Downloads` directory you are ready to run the test, which is done in the same way as any other Go tests.
204
204
205
205
Note that the tests require the queues `DEV.QUEUE.1` and `DEV.QUEUE.2` to be defined on your queue manager, be empty of messages and be accessible to the application username you are using. This will be the case by default for queue managers provisioned through the MQ on Cloud service, but may require manual configuration for queue managers you have created through other means.
@@ -218,10 +218,9 @@ ok github.com/ibm-messaging/mq-golang-jms20 11.308s
218
218
219
219
### Writing your own Golang application that talks to IBM MQ
220
220
Writing your own application to talk to IBM MQ is simple - as shown in the [sample_sendreceive_test.go](sample_sendreceive_test.go) sample. Simply import this module into your source file, and get started!
221
-
```
221
+
```golang
222
222
import (
223
223
"github.com/ibm-messaging/mq-golang-jms20/mqjms"
224
-
225
224
)
226
225
```
227
226
@@ -234,7 +233,7 @@ The first thing you'll need to do is create a ConnectionFactory object so that y
234
233
2. Create a new ConnectionFactory object and set the variables in your application code
235
234
- This is a quick and easy way to get started, but less desirable for production quality applications
236
235
- You can hardcode the values in your source file, or perhaps look them up from environment variables as shown below
0 commit comments