Skip to content

Commit 20efcf6

Browse files
committed
fix: update the custom microservices example to complete the callback
1 parent aded9a3 commit 20efcf6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

content/microservices/custom-transport.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,13 @@ class GoogleCloudPubSubClient extends ClientProxy {
192192
// In a real-world application, the "callback" function should be executed
193193
// with payload sent back from the responder. Here, we'll simply simulate (5 seconds delay)
194194
// that response came through by passing the same "data" as we've originally passed in.
195-
setTimeout(() => callback({ response: packet.data }), 5000);
195+
//
196+
// The "isDisposed" bool on the WritePacket tells the response that no further data is
197+
// expected. If not sent or is false, this will simply emit data to the Observable.
198+
setTimeout(() => callback({
199+
response: packet.data,
200+
isDisposed: true,
201+
}), 5000);
196202

197203
return () => console.log('teardown');
198204
}

0 commit comments

Comments
 (0)