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
Copy file name to clipboardExpand all lines: com.ibm.streamsx.websocket/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
1
Changes
2
2
=======
3
+
## v1.1.4:
4
+
* Mar/20/2023
5
+
* Made the second output port of the WebSocketSendReceive operator optional.
6
+
* Made the metrics counters for the three WebSocket operators to be reset to zero at a user defined time interval via a new optional parameter named metricsResetInterval.
7
+
3
8
## v1.1.3:
4
9
* Feb/01/2023
5
10
* Added a code fix to try/catch the invalid state exception thrown from within the websocketpp send method when sending data to a remote client or server and at that exact time that remote client or server closing its WebSocket connection due to that client or server application being shut down or for any other reason. This change was done for all the three WebSocket operators in this toolkit.
Copy file name to clipboardExpand all lines: com.ibm.streamsx.websocket/com.ibm.streamsx.websocket.op/WebSocketSendReceive/WebSocketSendReceive.xml
+18-6Lines changed: 18 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -44,11 +44,12 @@
44
44
remote WebSocket server. This input port must have either rstring strData or
45
45
blob blobData or both of them as the incoming tuple attribute(s).
46
46
47
-
This operator provides two output ports. On the first output port, it keeps returning the data
47
+
This operator provides two output ports where the first output port is mandatory and
48
+
the second output port is optional. On the first output port, it keeps returning the data
48
49
received from the remote server. This output port must have either rstring strData or
49
50
blob blobData or both of them as the output tuple attribute(s). Optionally, it can have
50
51
uint64 numberOfDataItemsReceived and uint64 numberOfDataBytesReceived attributes to be
51
-
assigned via the output functions provided by this operator. On the second output port,
52
+
assigned via the output functions provided by this operator. If the second output port is present,
52
53
it keeps returning the result about whether a given incoming tuple was successfully
53
54
sent to the remote server or not. This output port must have int32 sendResultCode and
54
55
rstring sendResultMessage as its output tuple attributes. A value of 0 in sendResultCode means
@@ -314,6 +315,16 @@
314
315
<type>boolean</type>
315
316
<cardinality>1</cardinality>
316
317
</parameter>
318
+
319
+
<parameter>
320
+
<name>metricsResetInterval</name>
321
+
<description>This parameter can be used to specify a non-zero periodic time interval in minutes after which all the metrics counters will be reset to 0. (Default is 0 which will never reset the metrics counters.)</description>
322
+
<optional>true</optional>
323
+
<rewriteAllowed>true</rewriteAllowed>
324
+
<expressionMode>AttributeFree</expressionMode>
325
+
<type>uint32</type>
326
+
<cardinality>1</cardinality>
327
+
</parameter>
317
328
</parameters>
318
329
319
330
<inputPorts>
@@ -367,9 +378,10 @@
367
378
368
379
<outputPortSet>
369
380
<description>
370
-
This port returns the result about whether a given input tuple consumed by this
371
-
operator was successfully sent to the remote WebSocket server or not. The schema
372
-
for this port must have two attributes: int32 sendResultCode, rstring sendResultMessage.
381
+
This is an optional output port. If it is present, it returns the result about
382
+
whether a given input tuple consumed by this operator was successfully sent to
383
+
the remote WebSocket server or not. The schema for this port must have two attributes:
384
+
int32 sendResultCode, rstring sendResultMessage.
373
385
sendResultCode will carry a value of 0 on a successful send to the remote server and a
374
386
non-zero result in case of an error in sending the data. sendResultMessage will
375
387
carry a descriptive message about the send result. Application logic can check these
Copy file name to clipboardExpand all lines: com.ibm.streamsx.websocket/com.ibm.streamsx.websocket.op/WebSocketSendReceive/WebSocketSendReceive_cpp.cgt
This particular operator (WebSocketSendReceive) is used to
14
14
send and receive either text data or binary data to and from a
@@ -154,51 +154,56 @@ if ($blobDataOutputAttributeFound == 1 and !(defined($dataOutputAsBlob))) {
154
154
SPL::CodeGen::exitln("WebSocketSendReceive_cpp.cgt: The required output tuple attribute 'blobData' is not of type 'blob' in the first output port.");
155
155
}
156
156
157
-
# Check the output port number 1 i.e. the second output port.
158
-
# It will carry the send result code of the most recent tuple transmission to
159
-
# the remote WebSocket server and the send error message if there is any error during transmission.
160
-
my $outputPort2 = $model->getOutputPortAt(1);
161
-
my $outputTupleName2 = $outputPort2->getCppTupleName();
162
-
my $sendResultCodeInt32 = undef;
163
-
my $sendResultMessageRString = undef;
164
-
my $outputAttrs2 = $outputPort2->getAttributes();
165
-
my $sendResultCodeAttributeFound = 0;
166
-
my $sendResultMessageAttributeFound = 0;
167
-
168
-
foreach my $outputAttr2 (@$outputAttrs2) {
169
-
my $outAttrName2 = $outputAttr2->getName();
170
-
my $outAttrType2 = $outputAttr2->getSPLType();
157
+
158
+
# Second output port i.e. output port number 1 is optional in this operator.
159
+
# Do the following if that output port is present.
160
+
if ($numberOfOutputPorts > 1) {
161
+
# Check the output port number 1 i.e. the second output port.
162
+
# It will carry the send result code of the most recent tuple transmission to
163
+
# the remote WebSocket server and the send error message if there is any error during transmission.
164
+
my $outputPort2 = $model->getOutputPortAt(1);
165
+
my $outputTupleName2 = $outputPort2->getCppTupleName();
166
+
my $sendResultCodeInt32 = undef;
167
+
my $sendResultMessageRString = undef;
168
+
my $outputAttrs2 = $outputPort2->getAttributes();
169
+
my $sendResultCodeAttributeFound = 0;
170
+
my $sendResultMessageAttributeFound = 0;
171
171
172
-
if ($outAttrName2 eq "sendResultCode") {
173
-
$sendResultCodeAttributeFound = 1;
172
+
foreach my $outputAttr2 (@$outputAttrs2) {
173
+
my $outAttrName2 = $outputAttr2->getName();
174
+
my $outAttrType2 = $outputAttr2->getSPLType();
174
175
175
-
if ($outAttrType2 eq "int32") {
176
-
# This tuple attribute will carry the result code for sending the most recent tuple.
177
-
$sendResultCodeInt32 = 1;
178
-
}
179
-
}
180
-
181
-
if ($outAttrName2 eq "sendResultMessage") {
182
-
$sendResultMessageAttributeFound = 1;
176
+
if ($outAttrName2 eq "sendResultCode") {
177
+
$sendResultCodeAttributeFound = 1;
178
+
179
+
if ($outAttrType2 eq "int32") {
180
+
# This tuple attribute will carry the result code for sending the most recent tuple.
181
+
$sendResultCodeInt32 = 1;
182
+
}
183
+
}
183
184
184
-
if ($outAttrType2 eq "rstring") {
185
-
# This tuple attribute will carry the error message if any while sending the most recent tuple.
186
-
$sendResultMessageRString = 1;
187
-
}
188
-
}
185
+
if ($outAttrName2 eq "sendResultMessage") {
186
+
$sendResultMessageAttributeFound = 1;
187
+
188
+
if ($outAttrType2 eq "rstring") {
189
+
# This tuple attribute will carry the error message if any while sending the most recent tuple.
190
+
$sendResultMessageRString = 1;
191
+
}
192
+
}
193
+
194
+
}
189
195
190
-
}
191
-
192
-
if ($sendResultCodeAttributeFound == 0 and $sendResultMessageAttributeFound == 0) {
193
-
SPL::CodeGen::exitln("WebSocketSendReceive_cpp.cgt: The required output tuple attribute 'sendResultCode' or 'sendResultMessage' is missing in the second output port.");
194
-
}
195
-
196
-
if ($sendResultCodeAttributeFound == 1 and !(defined($sendResultCodeInt32))) {
197
-
SPL::CodeGen::exitln("WebSocketSendReceive_cpp.cgt: The required output tuple attribute 'sendResultCode' is not of type 'int32' in the second output port.");
198
-
}
199
-
200
-
if ($sendResultMessageAttributeFound == 1 and !(defined($sendResultMessageRString))) {
201
-
SPL::CodeGen::exitln("WebSocketSendReceive_cpp.cgt: The required output tuple attribute 'sendResultMessage' is not of type 'rstring' in the second output port.");
196
+
if ($sendResultCodeAttributeFound == 0 and $sendResultMessageAttributeFound == 0) {
197
+
SPL::CodeGen::exitln("WebSocketSendReceive_cpp.cgt: The required output tuple attribute 'sendResultCode' or 'sendResultMessage' is missing in the second output port.");
198
+
}
199
+
200
+
if ($sendResultCodeAttributeFound == 1 and !(defined($sendResultCodeInt32))) {
201
+
SPL::CodeGen::exitln("WebSocketSendReceive_cpp.cgt: The required output tuple attribute 'sendResultCode' is not of type 'int32' in the second output port.");
202
+
}
203
+
204
+
if ($sendResultMessageAttributeFound == 1 and !(defined($sendResultMessageRString))) {
205
+
SPL::CodeGen::exitln("WebSocketSendReceive_cpp.cgt: The required output tuple attribute 'sendResultMessage' is not of type 'rstring' in the second output port.");
Copy file name to clipboardExpand all lines: com.ibm.streamsx.websocket/com.ibm.streamsx.websocket.op/WebSocketSink/WebSocketSink.xml
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -369,7 +369,17 @@
369
369
<expressionMode>AttributeFree</expressionMode>
370
370
<type>rstring</type>
371
371
<cardinality>1</cardinality>
372
-
</parameter>
372
+
</parameter>
373
+
374
+
<parameter>
375
+
<name>metricsResetInterval</name>
376
+
<description>This parameter can be used to specify a non-zero periodic time interval in minutes after which all the metrics counters will be reset to 0. (Default is 0 which will never reset the metrics counters.)</description>
0 commit comments