@@ -44,11 +44,12 @@ public MQSubscriberManager(String host, int port, String channel, String qmName,
44
44
* @param sendPCFCommands - this flag indicates, if we should send additional PCF commands (To get queues max depth, channels and listeners statuses).
45
45
* @param usePCFWildcards - this flag indicates, if we should use wildcards (uses only 1 connection per MQObject type, but longer response processing).
46
46
* @param interval - interval in seconds, at which additional PCF commands are sent.
47
+ * @param timeout - timeout for MQGET operation (milliseconds).
47
48
*/
48
- public void runSubscribers (List <PCFElement > elements , List <MQObject > objects , boolean sendPCFCommands , boolean usePCFWildcards , int interval ) {
49
+ public void runSubscribers (List <PCFElement > elements , List <MQObject > objects , boolean sendPCFCommands , boolean usePCFWildcards , int interval , int timeout ) {
49
50
logger .info ("Launching subscribers..." );
50
51
subscribers = new ArrayList <>();
51
- addTopicSubscribers (elements , objects );
52
+ addTopicSubscribers (elements , objects , timeout );
52
53
if (sendPCFCommands ) {
53
54
if (usePCFWildcards ) {
54
55
EnumMap <MQObject .MQType , ArrayList <MQObject >> groups = groupMQObjects (objects );
@@ -83,15 +84,16 @@ public void stopSubscribers() {
83
84
*
84
85
* @param elements - list with PCFElements, received from MQ.
85
86
* @param objects - list with monitored MQ objects.
87
+ * @param timeout - timeout for MQGET operation (milliseconds).
86
88
*/
87
- private void addTopicSubscribers (List <PCFElement > elements , List <MQObject > objects ) {
89
+ private void addTopicSubscribers (List <PCFElement > elements , List <MQObject > objects , int timeout ) {
88
90
for (PCFElement element : elements ) {
89
91
if (element .requiresMQObject ()) {
90
92
for (MQObject object : objects ) {
91
- addTopicSubscriber (object , element );
93
+ addTopicSubscriber (object , element , timeout );
92
94
}
93
95
} else {
94
- addTopicSubscriber (element );
96
+ addTopicSubscriber (element , timeout );
95
97
}
96
98
}
97
99
}
@@ -101,13 +103,14 @@ private void addTopicSubscribers(List<PCFElement> elements, List<MQObject> objec
101
103
*
102
104
* @param object - monitored MQ object.
103
105
* @param element - PCFElement, received from MQ.
106
+ * @param timeout - timeout for MQGET operation (milliseconds).
104
107
*/
105
- private void addTopicSubscriber (MQObject object , PCFElement element ) {
108
+ private void addTopicSubscriber (MQObject object , PCFElement element , int timeout ) {
106
109
if (object .getType ().equals (MQObject .MQType .QUEUE )) {
107
110
PCFElement objElement = new PCFElement (element .getTopicString (), element .getRows ());
108
111
objElement .formatTopicString (object .getName ());
109
112
try {
110
- subscribers .add (new MQTopicSubscriber (objElement , queueManagerName , connectionProperties , queueManagerName , object .getName ()));
113
+ subscribers .add (new MQTopicSubscriber (objElement , queueManagerName , connectionProperties , timeout , queueManagerName , object .getName ()));
111
114
} catch (MQException e ) {
112
115
logger .error ("Error during creating topic subscriber: " , e );
113
116
}
@@ -118,10 +121,11 @@ private void addTopicSubscriber(MQObject object, PCFElement element) {
118
121
* Adds topic subscriber
119
122
*
120
123
* @param element - PCFElement, received from MQ.
124
+ * @param timeout - timeout for MQGET operation (milliseconds).
121
125
*/
122
- private void addTopicSubscriber (PCFElement element ) {
126
+ private void addTopicSubscriber (PCFElement element , int timeout ) {
123
127
try {
124
- subscribers .add (new MQTopicSubscriber (element , queueManagerName , connectionProperties , queueManagerName ));
128
+ subscribers .add (new MQTopicSubscriber (element , queueManagerName , connectionProperties , timeout , queueManagerName ));
125
129
} catch (MQException e ) {
126
130
logger .error ("Error during creating topic subscriber: " , e );
127
131
}
0 commit comments