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