File tree Expand file tree Collapse file tree 2 files changed +32
-6
lines changed
Expand file tree Collapse file tree 2 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -69,10 +69,10 @@ type JMSContext interface {
6969 CreateBytesMessageWithBytes (bytes []byte ) BytesMessage
7070
7171 // Commit confirms all messages sent/received during this transaction.
72- Commit ()
72+ Commit () JMSException
7373
7474 // Rollback releases all messages sent/received during this transaction.
75- Rollback ()
75+ Rollback () JMSException
7676
7777 // Closes the connection to the messaging provider.
7878 //
Original file line number Diff line number Diff line change @@ -138,21 +138,47 @@ func (ctx ContextImpl) CreateBytesMessageWithBytes(bytes []byte) jms20subset.Byt
138138}
139139
140140// Commit confirms all messages that were sent under this transaction.
141- func (ctx ContextImpl ) Commit () {
141+ func (ctx ContextImpl ) Commit () jms20subset.JMSException {
142+
143+ var retErr jms20subset.JMSException
142144
143145 if (ibmmq.MQQueueManager {}) != ctx .qMgr {
144- ctx .qMgr .Cmit ()
146+ err := ctx .qMgr .Cmit ()
147+
148+ if err != nil {
149+
150+ rcInt := int (err .(* ibmmq.MQReturn ).MQRC )
151+ errCode := strconv .Itoa (rcInt )
152+ reason := ibmmq .MQItoString ("RC" , rcInt )
153+ retErr = jms20subset .CreateJMSException (reason , errCode , err )
154+
155+ }
156+
145157 }
146158
159+ return retErr
147160}
148161
149162// Rollback releases all messages that were sent under this transaction.
150- func (ctx ContextImpl ) Rollback () {
163+ func (ctx ContextImpl ) Rollback () jms20subset.JMSException {
164+
165+ var retErr jms20subset.JMSException
151166
152167 if (ibmmq.MQQueueManager {}) != ctx .qMgr {
153- ctx .qMgr .Back ()
168+ err := ctx .qMgr .Back ()
169+
170+ if err != nil {
171+
172+ rcInt := int (err .(* ibmmq.MQReturn ).MQRC )
173+ errCode := strconv .Itoa (rcInt )
174+ reason := ibmmq .MQItoString ("RC" , rcInt )
175+ retErr = jms20subset .CreateJMSException (reason , errCode , err )
176+
177+ }
154178 }
155179
180+ return retErr
181+
156182}
157183
158184// Close this connection to the MQ queue manager, and release any resources
You can’t perform that action at this time.
0 commit comments