ferocia-rubywmq 2.0.7 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +10 -0
  3. data/Gemfile.lock +36 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +36 -47
  6. data/Rakefile +14 -39
  7. data/examples/each_a.rb +2 -3
  8. data/examples/each_b.rb +4 -5
  9. data/examples/each_header.rb +5 -6
  10. data/examples/files_to_q.rb +7 -8
  11. data/examples/get_a.rb +3 -5
  12. data/examples/get_client.rb +9 -10
  13. data/examples/put1_a.rb +2 -3
  14. data/examples/put1_b.rb +4 -7
  15. data/examples/put1_c.rb +6 -6
  16. data/examples/put_a.rb +0 -2
  17. data/examples/put_b.rb +5 -7
  18. data/examples/put_dlh.rb +11 -12
  19. data/examples/put_dynamic_q.rb +7 -7
  20. data/examples/put_group_a.rb +3 -4
  21. data/examples/put_group_b.rb +7 -7
  22. data/examples/put_rfh.rb +13 -11
  23. data/examples/put_rfh2_a.rb +9 -10
  24. data/examples/put_rfh2_b.rb +9 -9
  25. data/examples/put_xmit_q.rb +63 -8
  26. data/examples/q_to_files.rb +6 -7
  27. data/examples/request.rb +20 -18
  28. data/examples/server.rb +19 -16
  29. data/ext/extconf.rb +2 -1
  30. data/ext/extconf_client.rb +3 -3
  31. data/ext/generate/generate_const.rb +30 -23
  32. data/ext/generate/generate_reason.rb +70 -72
  33. data/ext/generate/generate_structs.rb +20 -19
  34. data/ext/generate/wmq_structs.erb +67 -67
  35. data/ext/wmq.c +0 -16
  36. data/ext/wmq.h +0 -16
  37. data/ext/wmq_message.c +8 -24
  38. data/ext/wmq_mq_load.c +5 -17
  39. data/ext/wmq_queue.c +73 -90
  40. data/ext/wmq_queue_manager.c +71 -87
  41. data/lib/wmq/message.rb +36 -34
  42. data/lib/wmq/queue_manager.rb +30 -23
  43. data/lib/wmq/version.rb +1 -1
  44. data/rubywmq.gemspec +44 -0
  45. data/test/queue_manager_test.rb +334 -0
  46. data/test/test_helper.rb +14 -0
  47. metadata +13 -25
  48. data/ferocia-rubywmq.gemspec +0 -33
  49. data/tests/test.rb +0 -318
@@ -1,19 +1,3 @@
1
- /*
2
- * Copyright 2006 J. Reid Morrison
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
1
  #include "wmq.h"
18
2
 
19
3
  static ID ID_open;
@@ -401,7 +385,7 @@ VALUE QueueManager_initialize(VALUE self, VALUE hash)
401
385
  *
402
386
  * Throws:
403
387
  * * WMQ::WMQException if comp_code != MQCC_OK
404
- * * Except if :exception_on_error => false was supplied as a parameter
388
+ * * Except if exception_on_error: false was supplied as a parameter
405
389
  * to QueueManager.new
406
390
  */
407
391
  VALUE QueueManager_connect(VALUE self)
@@ -476,7 +460,7 @@ VALUE QueueManager_connect(VALUE self)
476
460
  *
477
461
  * Throws:
478
462
  * * WMQ::WMQException if comp_code != MQCC_OK
479
- * * Except if :exception_on_error => false was supplied as a parameter
463
+ * * Except if exception_on_error: false was supplied as a parameter
480
464
  * to QueueManager.new
481
465
  */
482
466
  VALUE QueueManager_disconnect(VALUE self)
@@ -526,7 +510,7 @@ VALUE QueueManager_disconnect(VALUE self)
526
510
  *
527
511
  * Note:
528
512
  * * commit will have no effect if all put and get operations were performed
529
- * without specifying :sync => true
513
+ * without specifying sync: true
530
514
  *
531
515
  * Returns:
532
516
  * * true : On Success
@@ -537,7 +521,7 @@ VALUE QueueManager_disconnect(VALUE self)
537
521
  *
538
522
  * Throws:
539
523
  * * WMQ::WMQException if comp_code != MQCC_OK
540
- * * Except if :exception_on_error => false was supplied as a parameter
524
+ * * Except if exception_on_error: false was supplied as a parameter
541
525
  * to QueueManager.new
542
526
  */
543
527
  VALUE QueueManager_commit(VALUE self)
@@ -578,7 +562,7 @@ VALUE QueueManager_commit(VALUE self)
578
562
  *
579
563
  * Note:
580
564
  * * backout will have no effect if all put and get operations were performed
581
- * without specifying :sync => true
565
+ * without specifying sync: true
582
566
  *
583
567
  * Returns:
584
568
  * * true : On Success
@@ -589,7 +573,7 @@ VALUE QueueManager_commit(VALUE self)
589
573
  *
590
574
  * Throws:
591
575
  * * WMQ::WMQException if comp_code != MQCC_OK
592
- * * Except if :exception_on_error => false was supplied as a parameter
576
+ * * Except if exception_on_error: false was supplied as a parameter
593
577
  * to QueueManager.new
594
578
  */
595
579
  VALUE QueueManager_backout(VALUE self)
@@ -628,7 +612,7 @@ VALUE QueueManager_backout(VALUE self)
628
612
  * resource such as a Database
629
613
  *
630
614
  * Starts a new unit of work under which put and get can be called with
631
- * with the parameter :sync => true
615
+ * with the parameter sync: true
632
616
  *
633
617
  * Returns:
634
618
  * * true : On Success
@@ -639,7 +623,7 @@ VALUE QueueManager_backout(VALUE self)
639
623
  *
640
624
  * Throws:
641
625
  * * WMQ::WMQException if comp_code != MQCC_OK
642
- * * Except if :exception_on_error => false was supplied as a parameter
626
+ * * Except if exception_on_error: false was supplied as a parameter
643
627
  * to QueueManager.new
644
628
  */
645
629
  VALUE QueueManager_begin(VALUE self)
@@ -682,17 +666,17 @@ VALUE QueueManager_begin(VALUE self)
682
666
  *
683
667
  * Summary of parameters and their WebSphere MQ equivalents
684
668
  * queue.get( # WebSphere MQ Equivalents:
685
- * :q_name => 'Queue Name', # MQOD.ObjectName
686
- * :q_name => { queue_manager=>'QMGR_name', # MQOD.ObjectQMgrName
687
- * q_name =>'q_name'}
688
- * :message => my_message, # n/a : Instance of Message
689
- * :data => "Hello World", # n/a : Data to send
690
- * :sync => false, # MQGMO_SYNCPOINT
691
- * :new_id => true, # MQPMO_NEW_MSG_ID & MQPMO_NEW_CORREL_ID
692
- * :new_msg_id => true, # MQPMO_NEW_MSG_ID
693
- * :new_correl_id => true, # MQPMO_NEW_CORREL_ID
694
- * :fail_if_quiescing => true, # MQOO_FAIL_IF_QUIESCING
695
- * :options => WMQ::MQPMO_FAIL_IF_QUIESCING # MQPMO_*
669
+ * q_name: 'Queue Name', # MQOD.ObjectName
670
+ * q_name: { queue_manager=>'QMGR_name', # MQOD.ObjectQMgrName
671
+ * q_name =>'q_name'}
672
+ * message: my_message, # n/a : Instance of Message
673
+ * data: "Hello World", # n/a : Data to send
674
+ * sync: false, # MQGMO_SYNCPOINT
675
+ * new_id: true, # MQPMO_NEW_MSG_ID & MQPMO_NEW_CORREL_ID
676
+ * new_msg_id: true, # MQPMO_NEW_MSG_ID
677
+ * new_correl_id: true, # MQPMO_NEW_CORREL_ID
678
+ * fail_if_quiescing: true, # MQOO_FAIL_IF_QUIESCING
679
+ * options: WMQ::MQPMO_FAIL_IF_QUIESCING # MQPMO_*
696
680
  * )
697
681
  *
698
682
  * Mandatory Parameters
@@ -768,7 +752,7 @@ VALUE QueueManager_begin(VALUE self)
768
752
  *
769
753
  * * :options => Fixnum (Advanced MQ Use only)
770
754
  * * Numeric field containing any of the MQ Put message options or'd together
771
- * * E.g. :options => WMQ::MQPMO_PASS_IDENTITY_CONTEXT | WMQ::MQPMO_ALTERNATE_USER_AUTHORITY
755
+ * * E.g. options: WMQ::MQPMO_PASS_IDENTITY_CONTEXT | WMQ::MQPMO_ALTERNATE_USER_AUTHORITY
772
756
  * * Note: If :options is supplied, it is applied first, then the above parameters are
773
757
  * applied afterwards.
774
758
  * * One or more of the following values:
@@ -795,7 +779,7 @@ VALUE QueueManager_begin(VALUE self)
795
779
  *
796
780
  * Throws:
797
781
  * * WMQ::WMQException if comp_code == MQCC_FAILED
798
- * * Except if :exception_on_error => false was supplied as a parameter
782
+ * * Except if exception_on_error: false was supplied as a parameter
799
783
  * to QueueManager.new
800
784
  */
801
785
  VALUE QueueManager_put(VALUE self, VALUE hash)
@@ -831,7 +815,7 @@ VALUE QueueManager_put(VALUE self, VALUE hash)
831
815
  {
832
816
  WMQ_HASH2MQCHARS(q_name, q_mgr_name, od.ObjectQMgrName)
833
817
 
834
- q_name = rb_hash_aref(val, ID2SYM(ID_q_name));
818
+ q_name = rb_hash_aref(q_name, ID2SYM(ID_q_name));
835
819
  if (NIL_P(q_name))
836
820
  {
837
821
  rb_raise(rb_eArgError,
@@ -1018,9 +1002,9 @@ static VALUE QueueManager_open_queue_each(VALUE parameters)
1018
1002
  * Example:
1019
1003
  * require 'wmq/wmq_client'
1020
1004
  *
1021
- * WMQ::QueueManager.connect(:q_mgr_name=>'REID', :connection_name=>'localhost(1414)') do |qmgr|
1022
- * qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:output) do |queue|
1023
- * queue.put(:data => 'Hello World')
1005
+ * WMQ::QueueManager.connect(q_mgr_name: 'REID', connection_name: 'localhost(1414)') do |qmgr|
1006
+ * qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :output) do |queue|
1007
+ * queue.put(data: 'Hello World')
1024
1008
  * end
1025
1009
  * end
1026
1010
  */
@@ -1086,43 +1070,43 @@ static VALUE QueueManager_singleton_connect_ensure(VALUE self)
1086
1070
  * * Since the number of parameters can vary dramatically, all parameters are passed by name in a hash
1087
1071
  * * Summary of parameters and their WebSphere MQ equivalents:
1088
1072
  * WMQ::QueueManager.connect( # WebSphere MQ Equivalents:
1089
- * :q_mgr_name => 'queue_manager name',
1090
- * :exception_on_error => true, # n/a
1091
- * :connect_options => WMQ::MQCNO_FASTBATH_BINDING # MQCNO.Options
1073
+ * q_mgr_name: 'queue_manager name',
1074
+ * exception_on_error: true, # n/a
1075
+ * connect_options: WMQ::MQCNO_FASTBATH_BINDING # MQCNO.Options
1092
1076
  *
1093
- * :trace_level => 0, # n/a
1077
+ * trace_level: 0, # n/a
1094
1078
  *
1095
1079
  * # Common client connection parameters
1096
- * :channel_name => 'svrconn channel name', # MQCD.ChannelName
1097
- * :connection_name => 'localhost(1414)', # MQCD.ConnectionName
1098
- * :transport_type => WMQ::MQXPT_TCP, # MQCD.TransportType
1080
+ * channel_name: 'svrconn channel name', # MQCD.ChannelName
1081
+ * connection_name: 'localhost(1414)', # MQCD.ConnectionName
1082
+ * transport_type: WMQ::MQXPT_TCP, # MQCD.TransportType
1099
1083
  *
1100
1084
  * # Advanced client connections parameters
1101
- * :max_msg_length => 65535, # MQCD.MaxMsgLength
1102
- * :security_exit => 'Name of security exit', # MQCD.SecurityExit
1103
- * :send_exit => 'Name of send exit', # MQCD.SendExit
1104
- * :receive_exit => 'Name of receive exit', # MQCD.ReceiveExit
1105
- * :security_user_data => 'Security exit User data', # MQCD.SecurityUserData
1106
- * :send_user_data => 'Send exit user data', # MQCD.SendUserData
1107
- * :receive_user_data => 'Receive exit user data', # MQCD.ReceiveUserData
1108
- * :heartbeat_interval => 1, # MQCD.HeartbeatInterval
1109
- * :remote_security_id => 'Remote Security id', # MQCD.RemoteSecurityId
1110
- * :ssl_cipher_spec => 'SSL Cipher Spec', # MQCD.SSLCipherSpec
1111
- * :keep_alive_interval=> -1, # MQCD.KeepAliveInterval
1112
- * :mode_name => 'LU6.2 Mode Name', # MQCD.ModeName
1113
- * :tp_name => 'LU6.2 Transaction pgm name', # MQCD.TpName
1114
- * :user_identifier => 'LU 6.2 Userid', # MQCD.UserIdentifier
1115
- * :password => 'LU6.2 Password', # MQCD.Password
1116
- * :long_remote_user_id=> 'Long remote user identifier', # MQCD.LongRemoteUserId (Ptr, Length)
1117
- * :ssl_peer_name => 'SSL Peer name', # MQCD.SSLPeerName (Ptr, Length)
1085
+ * max_msg_length: 65535, # MQCD.MaxMsgLength
1086
+ * security_exit: 'Name of security exit', # MQCD.SecurityExit
1087
+ * send_exit: 'Name of send exit', # MQCD.SendExit
1088
+ * receive_exit: 'Name of receive exit', # MQCD.ReceiveExit
1089
+ * security_user_data: 'Security exit User data', # MQCD.SecurityUserData
1090
+ * send_user_data: 'Send exit user data', # MQCD.SendUserData
1091
+ * receive_user_data: 'Receive exit user data', # MQCD.ReceiveUserData
1092
+ * heartbeat_interval: 1, # MQCD.HeartbeatInterval
1093
+ * remote_security_id: 'Remote Security id', # MQCD.RemoteSecurityId
1094
+ * ssl_cipher_spec: 'SSL Cipher Spec', # MQCD.SSLCipherSpec
1095
+ * keep_alive_interval: -1, # MQCD.KeepAliveInterval
1096
+ * mode_name: 'LU6.2 Mode Name', # MQCD.ModeName
1097
+ * tp_name: 'LU6.2 Transaction pgm name', # MQCD.TpName
1098
+ * user_identifier: 'LU 6.2 Userid', # MQCD.UserIdentifier
1099
+ * password: 'LU6.2 Password', # MQCD.Password
1100
+ * long_remote_user_id: 'Long remote user identifier', # MQCD.LongRemoteUserId (Ptr, Length)
1101
+ * ssl_peer_name: 'SSL Peer name', # MQCD.SSLPeerName (Ptr, Length)
1118
1102
  *
1119
1103
  * # SSL Options
1120
- * :key_repository => '/var/mqm/qmgrs/.../key', # MQSCO.KeyRepository
1121
- * :crypto_hardware => 'GSK_ACCELERATOR_NCIPHER_NF_ON', # MQSCO.CryptoHardware
1104
+ * key_repository: '/var/mqm/qmgrs/.../key', # MQSCO.KeyRepository
1105
+ * crypto_hardware: 'GSK_ACCELERATOR_NCIPHER_NF_ON', # MQSCO.CryptoHardware
1122
1106
  * )
1123
1107
  *
1124
1108
  * Optional Parameters
1125
- * * :q_mgr_name => String
1109
+ * * q_mgr_name: String
1126
1110
  * * Name of the existing WebSphere MQ Queue Manager to connect to
1127
1111
  *
1128
1112
  * * Default:
@@ -1211,13 +1195,13 @@ static VALUE QueueManager_singleton_connect_ensure(VALUE self)
1211
1195
  * require 'wmq/wmq_client'
1212
1196
  *
1213
1197
  * WMQ::QueueManager.connect(
1214
- * :channel_name => 'SYSTEM.DEF.SVRCONN',
1215
- * :transport_type => WMQ::MQXPT_TCP,
1216
- * :connection_name => 'localhost(1414)' ) do |qmgr|
1217
- * qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |queue|
1198
+ * channel_name: 'SYSTEM.DEF.SVRCONN',
1199
+ * transport_type: WMQ::MQXPT_TCP,
1200
+ * connection_name: 'localhost(1414)' ) do |qmgr|
1201
+ * qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
1218
1202
  *
1219
1203
  * message = WMQ::Message.new
1220
- * if queue.get(:message => message)
1204
+ * if queue.get(message: message)
1221
1205
  * puts "Data Received: #{message.data}"
1222
1206
  * else
1223
1207
  * puts 'No message available'
@@ -1348,41 +1332,41 @@ static int QueueManager_execute_each (VALUE key, VALUE value, PQUEUE_MANAGER pqm
1348
1332
  * Example
1349
1333
  * WMQ::QueueManager.connect do |qmgr|
1350
1334
  * result = qmgr.execute(
1351
- * :command => :inquire_q,
1352
- * :q_name => 'MY.LOCAL.QUEUE',
1353
- * :q_type => WMQ::MQQT_LOCAL,
1354
- * :current_q_depth => nil
1335
+ * command: :inquire_q,
1336
+ * q_name: 'MY.LOCAL.QUEUE',
1337
+ * q_type: WMQ::MQQT_LOCAL,
1338
+ * current_q_depth: nil
1355
1339
  * )
1356
1340
  * # OR, we can replace the method name execute with the MQAI command:
1357
1341
  * result = qmgr.inquire_q(
1358
- * :q_name => 'MY.LOCAL.QUEUE',
1359
- * :q_type => WMQ::MQQT_LOCAL,
1360
- * :current_q_depth => nil
1342
+ * q_name: 'MY.LOCAL.QUEUE',
1343
+ * q_type: WMQ::MQQT_LOCAL,
1344
+ * current_q_depth: nil
1361
1345
  * )
1362
1346
  *
1363
1347
  * Complete Example:
1364
1348
  * require 'wmq/wmq'
1365
1349
  * require 'wmq/wmq_const_admin'
1366
- * WMQ::QueueManager.connect(:q_mgr_name=>'REID', :connection_name=>'localhost(1414)') do |qmgr|
1367
- * qmgr.reset_q_stats(:q_name=>'*').each {|item| p item }
1350
+ * WMQ::QueueManager.connect(q_mgr_name: 'REID', connection_name: 'localhost(1414)') do |qmgr|
1351
+ * qmgr.reset_q_stats(q_name: '*').each {|item| p item }
1368
1352
  * end
1369
1353
  *
1370
1354
  * Some one line examples
1371
- * qmgr.inquire_q(:q_name=>'TEST*').each {|item| p item }
1355
+ * qmgr.inquire_q(q_name: 'TEST*').each {|item| p item }
1372
1356
  *
1373
- * qmgr.inquire_q(:q_name=>'TEST*', :q_type=>WMQ::MQQT_LOCAL, :current_q_depth=>nil).each {|item| p item }
1357
+ * qmgr.inquire_q(q_name: 'TEST*', q_type: WMQ::MQQT_LOCAL, current_q_depth: nil).each {|item| p item }
1374
1358
  *
1375
- * qmgr.inquire_process(:process_name=>'*').each {|item| p item }
1359
+ * qmgr.inquire_process(process_name:'*').each {|item| p item }
1376
1360
  *
1377
1361
  * qmgr.ping_q_mgr.each {|item| p item }
1378
1362
  *
1379
1363
  * qmgr.refresh_security.each {|item| p item }
1380
1364
  *
1381
- * qmgr.inquire_q_status(:q_name=>'TEST*', :q_status_type=>:q_status, :q_status_attrs=>:process_id).each {|item| p item }
1365
+ * qmgr.inquire_q_status(q_name: 'TEST*', q_status_type: :q_status, q_status_attrs: :process_id).each {|item| p item }
1382
1366
  *
1383
1367
  * qmgr.start_channel_listener.each {|item| p item }
1384
1368
  *
1385
- * qmgr.inquire_channel_status(:channel_name=>'*').each {|item| p item }
1369
+ * qmgr.inquire_channel_status(channel_name: '*').each {|item| p item }
1386
1370
  */
1387
1371
  VALUE QueueManager_execute(VALUE self, VALUE hash)
1388
1372
  {
@@ -17,45 +17,47 @@ module WMQ
17
17
  # * The format of any header should not be supplied in the descriptor or any header
18
18
  #
19
19
  # Message has the following attributes:
20
+ #
20
21
  # * descriptor = {
21
- # # WebSphere MQ Equivalent
22
- # :format => WMQ::MQFMT_STRING, # MQMD.Format - Format of data only
23
- # WMQ::MQFMT_NONE # Do not supply header formats here
24
- # :original_length => Number # MQMD.OriginalLength
25
- # :priority => 0 .. 9 # MQMD.Priority
26
- # :put_time => String # MQMD.PutTime
27
- # :msg_id => String ...
28
- # :expiry => Number
29
- # :persistence => Number
30
- # :reply_to_q => String
31
- # :correl_id => String
32
- # :feedback => Number
33
- # :offset => Number
34
- # :report => Number
35
- # :msg_flags => Number
36
- # :reply_to_q_mgr => String
37
- # :appl_identity_data => String
38
- # :put_appl_name => String
39
- # :user_identifier => String
40
- # :msg_seq_number => Number
41
- # :appl_origin_data => String
42
- # :accounting_token => String
43
- # :backout_count => Number
44
- # :coded_char_set_id => Number
45
- # :put_appl_type => Number
46
- # :msg_type => Number
47
- # :group_id => String
48
- # :put_date => String
49
- # :encoding => Number
50
- # }
51
- # * data => String
52
- # * headers => Array of Hashes
22
+ # # WebSphere MQ Equivalent
23
+ # format: WMQ::MQFMT_STRING, # MQMD.Format - Format of data only
24
+ # WMQ::MQFMT_NONE # Do not supply header formats here
25
+ # original_length: Number, # MQMD.OriginalLength
26
+ # priority: 0 .. 9, # MQMD.Priority
27
+ # put_time: String, # MQMD.PutTime
28
+ # msg_id: String, # ...
29
+ # expiry: Number,
30
+ # persistence: Number,
31
+ # reply_to_q: String,
32
+ # correl_id: String,
33
+ # feedback: Number,
34
+ # offset: Number,
35
+ # report: Number,
36
+ # msg_flags: Number,
37
+ # reply_to_q_mgr: String,
38
+ # appl_identity_data: String,
39
+ # put_appl_name: String,
40
+ # user_identifier: String,
41
+ # msg_seq_number: Number,
42
+ # appl_origin_data: String,
43
+ # accounting_token: String,
44
+ # backout_count: Number,
45
+ # coded_char_set_id: Number,
46
+ # put_appl_type: Number,
47
+ # msg_type: Number,
48
+ # group_id: String,
49
+ # put_date: String,
50
+ # encoding: Number
51
+ # }
52
+ #
53
+ # * data: String
54
+ # * headers: Array<Hash>
53
55
  # * Note: Do not supply the format of any header. Ruby WMQ does this for you.
54
56
  #
55
57
  # The following headers are supported:
56
58
  # * Rules And Formatting Header (RFH)
57
- # :header_type => :rf_header
58
- # :....
59
+ # header_type: :rf_header
60
+ # ....
59
61
  # * Rules and Formatting V2 Header (RFH2)
60
62
  # ....
61
63
  # * Dead Letter Header
@@ -6,11 +6,11 @@ module WMQ
6
6
  # Example
7
7
  # require 'wmq/wmq'
8
8
  # require 'wmq/wmq_const_admin'
9
- # WMQ::QueueManager.connect(:q_mgr_name=>'REID', :connection_name=>'localhost(1414)') do |qmgr|
9
+ # WMQ::QueueManager.connect(q_mgr_name: 'REID', connection_name: 'localhost(1414)') do |qmgr|
10
10
  # qmgr.mqsc('dis ql(*)').each {|item| p item }
11
11
  # end
12
12
  def mqsc(mqsc_text)
13
- self.execute(:command=>:escape, :escape_type=>WMQ::MQET_MQSC, :escape_text=>mqsc_text).collect {|item| item[:escape_text] }
13
+ execute(command: :escape, escape_type: WMQ::MQET_MQSC, escape_text: mqsc_text).collect { |item| item[:escape_text] }
14
14
  end
15
15
 
16
16
  # Put a reply message back to the sender
@@ -44,30 +44,35 @@ module WMQ
44
44
  if parms[:request_message].descriptor[:msg_type] == WMQ::MQMT_REQUEST
45
45
  request = parms.delete(:request_message)
46
46
 
47
- reply = parms[:message] ||= Message.new(:data=>parms[:data])
47
+ reply = parms[:message] ||= Message.new(data: parms[:data])
48
48
  reply.descriptor[:msg_type] = WMQ::MQMT_REPLY
49
49
  reply.descriptor[:expiry] = request.descriptor[:expiry]
50
50
  reply.descriptor[:priority] = request.descriptor[:priority]
51
51
  reply.descriptor[:persistence]= request.descriptor[:persistence]
52
- reply.descriptor[:format] = request.descriptor[:format]
52
+ reply.descriptor[:format] = request.descriptor[:format]
53
53
 
54
54
  # Set Correlation Id based on report options supplied
55
- if request.descriptor[:report] & WMQ::MQRO_PASS_CORREL_ID != 0
56
- reply.descriptor[:correl_id] = request.descriptor[:correl_id]
57
- else
58
- reply.descriptor[:correl_id] = request.descriptor[:msg_id]
59
- end
55
+ reply.descriptor[:correl_id] =
56
+ if request.descriptor[:report] & WMQ::MQRO_PASS_CORREL_ID != 0
57
+ request.descriptor[:correl_id]
58
+ else
59
+ request.descriptor[:msg_id]
60
+ end
60
61
 
61
62
  # Set Message Id based on report options supplied
62
63
  if request.descriptor[:report] & WMQ::MQRO_PASS_MSG_ID != 0
63
64
  reply.descriptor[:msg_id] = request.descriptor[:msg_id]
64
65
  end
65
66
 
66
- parms[:q_name] = request.descriptor[:reply_to_q]
67
- parms[:q_mgr_name]= request.descriptor[:reply_to_q_mgr]
68
- return put(parms)
67
+ q_name = {
68
+ q_name: request.descriptor[:reply_to_q],
69
+ q_mgr_name: request.descriptor[:reply_to_q_mgr]
70
+ }
71
+
72
+ parms[:q_name] = q_name
73
+ put(parms)
69
74
  else
70
- return false
75
+ false
71
76
  end
72
77
  end
73
78
 
@@ -83,24 +88,26 @@ module WMQ
83
88
  # are retained.
84
89
  #
85
90
  def put_to_dead_letter_q(parms)
86
- message = parms[:message] ||= Message.new(:data=>parms[:data])
87
- dlh = {
88
- :header_type =>:dead_letter_header,
89
- :reason =>parms.delete(:reason),
90
- :dest_q_name =>parms.delete(:q_name),
91
- :dest_q_mgr_name =>self.name}
91
+ message = parms[:message] ||= Message.new(data: parms[:data])
92
+ dlh = {
93
+ header_type: :dead_letter_header,
94
+ reason: parms.delete(:reason),
95
+ dest_q_name: parms.delete(:q_name),
96
+ dest_q_mgr_name: name
97
+ }
92
98
 
93
99
  message.headers.unshift(dlh)
94
- parms[:q_name]='SYSTEM.DEAD.LETTER.QUEUE' #TODO Should be obtained from QMGR config
95
- return self.put(parms)
100
+ parms[:q_name] = 'SYSTEM.DEAD.LETTER.QUEUE' #TODO Should be obtained from QMGR config
101
+
102
+ put(parms)
96
103
  end
97
104
 
98
105
  # Expose Commands directly as Queue Manager methods
99
106
  def method_missing(name, *args)
100
107
  if args.size == 1
101
- self.execute({:command=>name}.merge(args[0]))
108
+ execute({ command: name }.merge(args[0]))
102
109
  elsif args.size == 0
103
- self.execute({:command=>name})
110
+ execute(command: name)
104
111
  else
105
112
  raise("Invalid arguments supplied to QueueManager#:#{name}, args:#{args}")
106
113
  end